diff options
author | Bill Paul <wpaul@FreeBSD.org> | 1996-12-31 07:10:19 +0000 |
---|---|---|
committer | Bill Paul <wpaul@FreeBSD.org> | 1996-12-31 07:10:19 +0000 |
commit | 1b4a7d506fa82aa9b477267e97ee0def4f155325 (patch) | |
tree | d67e43924543c70a95e77a11db261a4977010ea0 /sys/nfs | |
parent | 53f49427b05ec9c9b7d8df2aacc3d97c2f8616a9 (diff) | |
download | src-1b4a7d506fa82aa9b477267e97ee0def4f155325.tar.gz src-1b4a7d506fa82aa9b477267e97ee0def4f155325.zip |
Fix (properly, I hope) 'panic: sillyrename dir' crash that can happen
if you do:
% cd /nfsdir
% mkdir -p foo/foo
% mv foo/foo .
nfs_sillyrename() self-destructs if you try to sillyrename a directory,
however nfs_rename() can be coerced into doing just that by the above
sequence of commands. To avoid this, nfs_rename() now checks that
v_type of the 'destination' vnode != VDIR before attempting the
sillyrename. The server correctly handles this particular situation
by returning ENOTEMPTY on the rename() attempt.
I asked if this was the correct fix for this on -hackers but nobody
ever answered.
This is a 2.2 candidate.
Notes
Notes:
svn path=/head/; revision=21124
Diffstat (limited to 'sys/nfs')
-rw-r--r-- | sys/nfs/nfs_vnops.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/sys/nfs/nfs_vnops.c b/sys/nfs/nfs_vnops.c index 4405179f07c6..0bffdb6bb0c2 100644 --- a/sys/nfs/nfs_vnops.c +++ b/sys/nfs/nfs_vnops.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * @(#)nfs_vnops.c 8.5 (Berkeley) 2/13/94 - * $Id: nfs_vnops.c,v 1.37 1996/11/06 10:53:12 dfr Exp $ + * $Id: nfs_vnops.c,v 1.38 1996/12/13 21:29:07 wollman Exp $ */ /* @@ -1606,9 +1606,10 @@ nfs_rename(ap) /* * If the tvp exists and is in use, sillyrename it before doing the * rename of the new file over it. + * XXX Can't sillyrename a directory. */ if (tvp && tvp->v_usecount > 1 && !VTONFS(tvp)->n_sillyrename && - !nfs_sillyrename(tdvp, tvp, tcnp)) { + tvp->v_type != VDIR && !nfs_sillyrename(tdvp, tvp, tcnp)) { vrele(tvp); tvp = NULL; } |