diff options
author | mckusick <mckusick@FreeBSD.org> | 1998-09-30 00:53:40 +0000 |
---|---|---|
committer | mckusick <mckusick@FreeBSD.org> | 1998-09-30 00:53:40 +0000 |
commit | a66a5d3d3ab296c2be09257306422b565f4756b1 (patch) | |
tree | bd179b64606af20b865160f575e8fb948e26a363 /sys/ufs | |
parent | 3839e92a79b1d4197c630927704b34f6d4532493 (diff) | |
download | FreeBSD-src-a66a5d3d3ab296c2be09257306422b565f4756b1.zip FreeBSD-src-a66a5d3d3ab296c2be09257306422b565f4756b1.tar.gz |
Do not allow a mounted on directory to be rmdir'ed. This removal can
happen when an NFS exported filesystem tries to remove a locally
mounted on directory.
PR: kern/7272
Submitted by: Andre Albsmeier <andre.albsmeier@mchp.siemens.de>
Diffstat (limited to 'sys/ufs')
-rw-r--r-- | sys/ufs/ufs/ufs_vnops.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/sys/ufs/ufs/ufs_vnops.c b/sys/ufs/ufs/ufs_vnops.c index 486401e..11592f9 100644 --- a/sys/ufs/ufs/ufs_vnops.c +++ b/sys/ufs/ufs/ufs_vnops.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)ufs_vnops.c 8.27 (Berkeley) 5/27/95 - * $Id: ufs_vnops.c,v 1.98 1998/08/12 20:46:47 julian Exp $ + * $Id: ufs_vnops.c,v 1.99 1998/08/12 21:42:54 msmith Exp $ */ #include "opt_quota.h" @@ -1481,7 +1481,9 @@ ufs_rmdir(ap) * Do not remove a directory that is in the process of being renamed. * Verify the directory is empty (and valid). Rmdir ".." will not be * valid since ".." will contain a reference to the current directory - * and thus be non-empty. + * and thus be non-empty. Do not allow the removal of mounted on + * directories (this can happen when an NFS exported filesystem + * tries to remove a locally mounted on directory). */ error = 0; if (ip->i_flag & IN_RENAME) { @@ -1498,6 +1500,10 @@ ufs_rmdir(ap) error = EPERM; goto out; } + if (vp->v_mountedhere != 0) { + error = EINVAL; + goto out; + } /* * Delete reference to directory before purging * inode. If we crash in between, the directory |