On 10 Sep, Terry Lambert wrote:
> Bruce Evans wrote:
>> The changes are obviously just cleanups for leaf file systems, but I
>> wonder why everything wasn't always locked at the top.  Could it have
>> been because locking all the way down is harmful?
> For a stacked local media FS, you can end up with a deadlock, if
> a lower vnode is exposed into the visible namespace, e.g.:> 
>               o                    o
>   /usr/myfs2  |      /usr/myfs1    |
> ,------------------.------------------.
> |             |    |              /   |
> | quotafs     o    |          /       |
> `------------------'      /           |
> |                \     /              |
> | ffs               o                 |
> `-------------------------------------'

In general you are correct.  In this case I think we are safe if we look
up the first vnode and leave it unlocked, verify that it is not a
directory, do the second lookup and only lock the parent directory, and
only then lock the first vnode.  Even with stacking, we won't attempt to
lock the same vnode twice because we guarantee that the vnodes are of
different types before we do the second lock.

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message

Reply via email to