From owner-freebsd-current Tue Sep 10 5: 2:43 2002 Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id C56B237B406; Tue, 10 Sep 2002 05:02:38 -0700 (PDT) Received: from gw.catspoiler.org (217-ip-163.nccn.net [209.79.217.163]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8B34143EA9; Tue, 10 Sep 2002 05:02:15 -0700 (PDT) (envelope-from dl-freebsd@catspoiler.org) Received: from mousie.catspoiler.org (mousie.catspoiler.org [192.168.101.2]) by gw.catspoiler.org (8.12.5/8.12.5) with ESMTP id g8AC0uwr094918; Tue, 10 Sep 2002 05:01:01 -0700 (PDT) (envelope-from dl-freebsd@catspoiler.org) Message-Id: <200209101201.g8AC0uwr094918@gw.catspoiler.org> Date: Tue, 10 Sep 2002 05:00:56 -0700 (PDT) From: Don Lewis Subject: Re: vnode lock assertion problem in nfs_link() To: tlambert2@mindspring.com Cc: bde@zeta.org.au, rwatson@FreeBSD.ORG, current@FreeBSD.ORG, jeff@FreeBSD.ORG In-Reply-To: <3D7DD2FC.A559730E@mindspring.com> MIME-Version: 1.0 Content-Type: TEXT/plain; charset=us-ascii Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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