git: 4ea15740a873 - stable/14 - tmpfs: remove duplicate flags check in tmpfs_rmdir

From: Alan Somers <asomers_at_FreeBSD.org>
Date: Mon, 20 Jan 2025 16:20:40 UTC
The branch stable/14 has been updated by asomers:

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

commit 4ea15740a87314302dcb79d48b9280be199b0173
Author:     Claudiu <mscotty@protonmail.ch>
AuthorDate: 2024-10-13 20:00:42 +0000
Commit:     Alan Somers <asomers@FreeBSD.org>
CommitDate: 2025-01-20 16:20:20 +0000

    tmpfs: remove duplicate flags check in tmpfs_rmdir
    
    Reviewed By:    asomers
    Differential Revision: https://reviews.freebsd.org/D47100
    
    (cherry picked from commit ec22e705c266ff629cc5ec47b84f67ba02b7b924)
---
 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 729feb0329a4..a42ada6a5469 100644
--- a/sys/fs/tmpfs/tmpfs_vnops.c
+++ b/sys/fs/tmpfs/tmpfs_vnops.c
@@ -1327,6 +1327,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;
@@ -1344,13 +1345,6 @@ tmpfs_rmdir(struct vop_rmdir_args *v)
 	    v->a_cnp->cn_nameptr,
 	    v->a_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);
 	if (v->a_cnp->cn_flags & DOWHITEOUT)