From owner-freebsd-current Tue Sep 10 2:56:10 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 626D037B400; Tue, 10 Sep 2002 02:56:07 -0700 (PDT) Received: from mailman.zeta.org.au (mailman.zeta.org.au [203.26.10.16]) by mx1.FreeBSD.org (Postfix) with ESMTP id CDA1343E65; Tue, 10 Sep 2002 02:56:05 -0700 (PDT) (envelope-from bde@zeta.org.au) Received: from bde.zeta.org.au (bde.zeta.org.au [203.2.228.102]) by mailman.zeta.org.au (8.9.3/8.8.7) with ESMTP id TAA18045; Tue, 10 Sep 2002 19:55:54 +1000 Date: Tue, 10 Sep 2002 20:03:37 +1000 (EST) From: Bruce Evans X-X-Sender: bde@gamplex.bde.org To: Don Lewis Cc: rwatson@FreeBSD.ORG, , Subject: Re: vnode lock assertion problem in nfs_link() In-Reply-To: <200209100849.g8A8nWwr094342@gw.catspoiler.org> Message-ID: <20020910194838.M876-100000@gamplex.bde.org> 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 Tue, 10 Sep 2002, Don Lewis wrote: > On 10 Sep, Bruce Evans wrote: > >> The locking changes in union_link() need a thorough review, > >> though the light testing of that I performed didn't turn up any > >> glaring problems. > > > > 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? > > Judging by how the leaf filesystems were careful to only do the lock if > tdvp != vp, I suspect there was the potential for a deadlock if both > vnodes were automatically locked at the top. I think this is because some places are still worrying about using link(2) on directories. I think there aren't any significant problems when vp is not a directory. Hard linking of directories was permitted (and perhaps even supported) until relatively recently: % RCS file: /home/ncvs/src/sys/kern/vfs_syscalls.c,v % Working file: vfs_syscalls.c % head: 1.285 % ... % ---------------------------- % revision 1.48 % date: 1996/05/24 16:19:23; author: peter; state: Exp; lines: +9 -7 % Dont allow directories to be link()ed or unlink()ed, even for root % (returns EPERM always, the errno is specified by POSIX). % % If you really have a desperate need to link or unlink a directory, you % can use fsdb. :-) % % This should stop any chance of ftpd, rdist, "rm -rf", etc from % bugging out and damaging the filesystem structure or loosing races % with malicious users. % % Reviewed by: davidg, bde % ---------------------------- > > The ugly gotos and uglier braces near them could be replaced by simple > > returns now. Some related points: > > We can't change the gotos to returns unless we also make the change in > (1). I think I agree with you about (1), but VN_KNOTE() doesn't have a > man page and I didn't want to change anything that I didn't understand. > I think (1) deserves a separate sweep and mega-commit. A quick look at > ufs_vnops.c turns up a number of inconsistencies in the use of > VN_KNOTE(). > > (1) I think it is just a bug that null changes for failed operations are > > knoted. It might be useful for knote to report attempted operations OK. I have fixed some of these inconsistencies in my version, but haven't done a sweep or tested kevent. Bruce To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message