How is supposed to be protected the units list?

Attilio Rao attilio at freebsd.org
Sun Mar 21 16:22:22 UTC 2010


2010/3/21 Scott Long <scottl at samsco.org>:
>
> On Mar 21, 2010, at 10:02 AM, Attilio Rao wrote:
>
>> 2010/3/21 Alexander Motin <mav at freebsd.org>:
>>> Attilio Rao wrote:
>>>> So I made this new patch using the bus lock:
>>>> http://www.freebsd.org/~attilio/Sandvine/pdrv/xpt_lock.diff
>>>
>>> OK. I've looked on both and I think both have race window between unit
>>> number allocation and insertion into the list. I've changed last patch
>>> to not drop the lock in meantime. What do you think about this:
>>> http://people.freebsd.org/~mav/unit_lock.patch
>>> ?
>>>
>>> Part about scsi_da.c I don't like in both cases, as I am not sure that
>>> locks can't be recursed there in case of some errors. I don't see how
>>> adding second lock could solve it.
>>
>> I think that we should protect there in anyway.
>> Probabilly we may cache the list and refcount the periphs? (then
>> unlock the lock and just do the lockless operation in order to avoid
>> recursion?)
>> The race handling for units allocation is fine, thanks.
>>
>
> Please give me a few more days to review and comment on this.  Alexander's change is very invasive in that it re-orders operations, and I'd like to review it to ensure that that doesn't break existing ordering assumptions.
>

Anyways, we should not undervalue the shutdown case for scsi_da, it is
easilly race prone as Matt has proven.
If you could comment on it, also, I would appreciate.

Thanks,
Attilio


-- 
Peace can only be achieved by understanding - A. Einstein


More information about the freebsd-scsi mailing list