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>
This commit is contained in:
Kirk McKusick 1998-09-30 00:53:40 +00:00
parent 6a04333133
commit df077352a7

View File

@ -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