diff mbox series

[2/2] fuse: remove an unnecessary if statement

Message ID 20230608084609.14245-3-zhangjiachen.jaycee@bytedance.com (mailing list archive)
State New, archived
Headers show
Series fuse: fixes for remote locking | expand

Commit Message

Jiachen Zhang June 8, 2023, 8:46 a.m. UTC
FUSE remote locking code paths never add any locking state to
inode->i_flctx, so the locks_remove_posix() function called on
file close will return without calling fuse_setlk().

Therefore, as the if statement to be removed in this commit will
always be false, remove it for clearness.

Fixes: 7142125937e1 ("[PATCH] fuse: add POSIX file locking support")
Signed-off-by: Jiachen Zhang <zhangjiachen.jaycee@bytedance.com>
---
 fs/fuse/file.c | 4 ----
 1 file changed, 4 deletions(-)

Comments

Miklos Szeredi March 6, 2024, 9:13 a.m. UTC | #1
On Thu, 8 Jun 2023 at 10:47, Jiachen Zhang
<zhangjiachen.jaycee@bytedance.com> wrote:
>
> FUSE remote locking code paths never add any locking state to
> inode->i_flctx, so the locks_remove_posix() function called on
> file close will return without calling fuse_setlk().
>
> Therefore, as the if statement to be removed in this commit will
> always be false, remove it for clearness.
>
> Fixes: 7142125937e1 ("[PATCH] fuse: add POSIX file locking support")
> Signed-off-by: Jiachen Zhang <zhangjiachen.jaycee@bytedance.com>

Applied, thanks.

Miklos
diff mbox series

Patch

diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index 7fe9d405969e..57789215c666 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -2619,10 +2619,6 @@  static int fuse_setlk(struct file *file, struct file_lock *fl, int flock)
 		return -ENOLCK;
 	}
 
-	/* Unlock on close is handled by the flush method */
-	if ((fl->fl_flags & FL_CLOSE_POSIX) == FL_CLOSE_POSIX)
-		return 0;
-
 	fuse_lk_fill(&args, file, fl, opcode, pid_nr, flock, &inarg);
 	err = fuse_simple_request(fm, &args);