How is supposed to be protected the units list?

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


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.

Thanks,
Attilio


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


More information about the freebsd-scsi mailing list