Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 10 Sep 2002 05:00:56 -0700 (PDT)
From:      Don Lewis <dl-freebsd@catspoiler.org>
To:        tlambert2@mindspring.com
Cc:        bde@zeta.org.au, rwatson@FreeBSD.ORG, current@FreeBSD.ORG, jeff@FreeBSD.ORG
Subject:   Re: vnode lock assertion problem in nfs_link()
Message-ID:  <200209101201.g8AC0uwr094918@gw.catspoiler.org>
In-Reply-To: <3D7DD2FC.A559730E@mindspring.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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 majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200209101201.g8AC0uwr094918>