diff options
author | Visa Hankala <visa@cvs.openbsd.org> | 2018-06-21 14:17:24 +0000 |
---|---|---|
committer | Visa Hankala <visa@cvs.openbsd.org> | 2018-06-21 14:17:24 +0000 |
commit | 6db88b4a178a94be5b99ce5621083450cb52032f (patch) | |
tree | 8db6b7f7a6e1ff27af9006f32ef80e7640ff61c4 | |
parent | d780a14dcf52ccdcff55fc3d17671d34951652af (diff) |
Drop redundant "node == parent node" checks from VOP_RMDIR()
implementations. Rely on the VFS layer to do the checking.
OK mpi@, helg@
-rw-r--r-- | sys/kern/vfs_vops.c | 4 | ||||
-rw-r--r-- | sys/miscfs/fuse/fuse_vnops.c | 11 | ||||
-rw-r--r-- | sys/msdosfs/msdosfs_vnops.c | 10 | ||||
-rw-r--r-- | sys/nfs/nfs_vnops.c | 9 | ||||
-rw-r--r-- | sys/ufs/ext2fs/ext2fs_vnops.c | 10 | ||||
-rw-r--r-- | sys/ufs/ufs/ufs_vnops.c | 13 |
6 files changed, 8 insertions, 49 deletions
diff --git a/sys/kern/vfs_vops.c b/sys/kern/vfs_vops.c index fb2d89f5895..32fcb4a24cc 100644 --- a/sys/kern/vfs_vops.c +++ b/sys/kern/vfs_vops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vfs_vops.c,v 1.18 2018/04/28 03:13:05 visa Exp $ */ +/* $OpenBSD: vfs_vops.c,v 1.19 2018/06/21 14:17:23 visa Exp $ */ /* * Copyright (c) 2010 Thordur I. Bjornsson <thib@openbsd.org> * @@ -458,6 +458,8 @@ VOP_RMDIR(struct vnode *dvp, struct vnode *vp, struct componentname *cnp) ASSERT_VP_ISLOCKED(dvp); ASSERT_VP_ISLOCKED(vp); + KASSERT(dvp != vp); + if (dvp->v_op->vop_rmdir == NULL) return (EOPNOTSUPP); diff --git a/sys/miscfs/fuse/fuse_vnops.c b/sys/miscfs/fuse/fuse_vnops.c index 0c2fc2e4e33..051c6335f26 100644 --- a/sys/miscfs/fuse/fuse_vnops.c +++ b/sys/miscfs/fuse/fuse_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fuse_vnops.c,v 1.48 2018/06/20 10:57:39 helg Exp $ */ +/* $OpenBSD: fuse_vnops.c,v 1.49 2018/06/21 14:17:23 visa Exp $ */ /* * Copyright (c) 2012-2013 Sylvestre Gallon <ccna.syl@gmail.com> * @@ -1399,15 +1399,6 @@ fusefs_rmdir(void *v) goto out; } - /* - * No rmdir "." please. - */ - if (dp == ip) { - vrele(dvp); - vput(vp); - return (EINVAL); - } - VN_KNOTE(dvp, NOTE_WRITE | NOTE_LINK); fbuf = fb_setup(cnp->cn_namelen + 1, dp->ufs_ino.i_number, diff --git a/sys/msdosfs/msdosfs_vnops.c b/sys/msdosfs/msdosfs_vnops.c index fd86ca4e84e..a2e465cbb3a 100644 --- a/sys/msdosfs/msdosfs_vnops.c +++ b/sys/msdosfs/msdosfs_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: msdosfs_vnops.c,v 1.121 2018/06/07 13:37:28 visa Exp $ */ +/* $OpenBSD: msdosfs_vnops.c,v 1.122 2018/06/21 14:17:23 visa Exp $ */ /* $NetBSD: msdosfs_vnops.c,v 1.63 1997/10/17 11:24:19 ws Exp $ */ /*- @@ -1383,14 +1383,6 @@ msdosfs_rmdir(void *v) ip = VTODE(vp); dp = VTODE(dvp); /* - * No rmdir "." please. - */ - if (dp == ip) { - vrele(dvp); - vput(vp); - return (EINVAL); - } - /* * Verify the directory is empty (and valid). * (Rmdir ".." won't be valid since * ".." will contain a reference to diff --git a/sys/nfs/nfs_vnops.c b/sys/nfs/nfs_vnops.c index 956a6f4a5d9..09996f30c7f 100644 --- a/sys/nfs/nfs_vnops.c +++ b/sys/nfs/nfs_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nfs_vnops.c,v 1.177 2018/06/07 13:37:28 visa Exp $ */ +/* $OpenBSD: nfs_vnops.c,v 1.178 2018/06/21 14:17:23 visa Exp $ */ /* $NetBSD: nfs_vnops.c,v 1.62.4.1 1996/07/08 20:26:52 jtc Exp $ */ /* @@ -1975,13 +1975,6 @@ nfs_rmdir(void *v) info.nmi_v3 = NFS_ISV3(dvp); - if (dvp == vp) { - vrele(dvp); - vput(dvp); - pool_put(&namei_pool, cnp->cn_pnbuf); - return (EINVAL); - } - nfsstats.rpccnt[NFSPROC_RMDIR]++; info.nmi_mb = info.nmi_mreq = nfsm_reqhead(NFSX_FH(info.nmi_v3) + NFSX_UNSIGNED + nfsm_rndup(cnp->cn_namelen)); diff --git a/sys/ufs/ext2fs/ext2fs_vnops.c b/sys/ufs/ext2fs/ext2fs_vnops.c index bb68bce04df..ba9d53f3fd3 100644 --- a/sys/ufs/ext2fs/ext2fs_vnops.c +++ b/sys/ufs/ext2fs/ext2fs_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ext2fs_vnops.c,v 1.83 2018/06/07 13:37:28 visa Exp $ */ +/* $OpenBSD: ext2fs_vnops.c,v 1.84 2018/06/21 14:17:23 visa Exp $ */ /* $NetBSD: ext2fs_vnops.c,v 1.1 1997/06/11 09:34:09 bouyer Exp $ */ /* @@ -1013,14 +1013,6 @@ ext2fs_rmdir(void *v) ip = VTOI(vp); dp = VTOI(dvp); /* - * No rmdir "." please. - */ - if (dp == ip) { - vrele(dvp); - vput(vp); - return (EINVAL); - } - /* * Verify the directory is empty (and valid). * (Rmdir ".." won't be valid since * ".." will contain a reference to diff --git a/sys/ufs/ufs/ufs_vnops.c b/sys/ufs/ufs/ufs_vnops.c index b984a4c1c89..20f2a179e6b 100644 --- a/sys/ufs/ufs/ufs_vnops.c +++ b/sys/ufs/ufs/ufs_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ufs_vnops.c,v 1.141 2018/06/13 14:57:24 visa Exp $ */ +/* $OpenBSD: ufs_vnops.c,v 1.142 2018/06/21 14:17:23 visa Exp $ */ /* $NetBSD: ufs_vnops.c,v 1.18 1996/05/11 18:28:04 mycroft Exp $ */ /* @@ -1293,17 +1293,6 @@ ufs_rmdir(void *v) ip = VTOI(vp); dp = VTOI(dvp); /* - * No rmdir ".". - */ - if (dp == ip) { - if (dp == ip) - vrele(dvp); - else - vput(dvp); - vput(vp); - return (EINVAL); - } - /* * 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 |