git: ec22e705c266 - main - tmpfs: remove duplicate flags check in tmpfs_rmdir

From: Alan Somers <asomers_at_FreeBSD.org>
Date: Sun, 13 Oct 2024 21:47:28 UTC
The branch main has been updated by asomers:

URL: https://cgit.FreeBSD.org/src/commit/?id=ec22e705c266ff629cc5ec47b84f67ba02b7b924

commit ec22e705c266ff629cc5ec47b84f67ba02b7b924
Author:     Claudiu <mscotty@protonmail.ch>
AuthorDate: 2024-10-13 20:00:42 +0000
Commit:     Alan Somers <asomers@FreeBSD.org>
CommitDate: 2024-10-13 21:43:52 +0000

    tmpfs: remove duplicate flags check in tmpfs_rmdir
    
    MFC after:      2 weeks
    Reviewed By:    asomers
    Differential Revision: https://reviews.freebsd.org/D47100
---
 sys/fs/tmpfs/tmpfs_vnops.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/sys/fs/tmpfs/tmpfs_vnops.c b/sys/fs/tmpfs/tmpfs_vnops.c
index fa9945a9074a..c2559a61fe37 100644
--- a/sys/fs/tmpfs/tmpfs_vnops.c
+++ b/sys/fs/tmpfs/tmpfs_vnops.c
@@ -1344,6 +1344,7 @@ tmpfs_rmdir(struct vop_rmdir_args *v)
 		goto out;
 	}
 
+	/* Check flags to see if we are allowed to remove the directory. */
 	if ((dnode->tn_flags & APPEND)
 	    || (node->tn_flags & (NOUNLINK | IMMUTABLE | APPEND))) {
 		error = EPERM;
@@ -1361,13 +1362,6 @@ tmpfs_rmdir(struct vop_rmdir_args *v)
 	    cnp->cn_nameptr,
 	    cnp->cn_namelen));
 
-	/* Check flags to see if we are allowed to remove the directory. */
-	if ((dnode->tn_flags & APPEND) != 0 ||
-	    (node->tn_flags & (NOUNLINK | IMMUTABLE | APPEND)) != 0) {
-		error = EPERM;
-		goto out;
-	}
-
 	/* Detach the directory entry from the directory (dnode). */
 	tmpfs_dir_detach(dvp, de);