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 [EMAIL PROTECTED] with "unsubscribe freebsd-current" in the body of the message