fuse: remove an unnecessary if statement
authorJiachen Zhang <zhangjiachen.jaycee@bytedance.com>
Thu, 8 Jun 2023 08:46:09 +0000 (16:46 +0800)
committerMiklos Szeredi <mszeredi@redhat.com>
Wed, 6 Mar 2024 08:56:54 +0000 (09:56 +0100)
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.

Signed-off-by: Jiachen Zhang <zhangjiachen.jaycee@bytedance.com>
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
fs/fuse/file.c

index 761ae81ef41d5d77a8e4ffa9baea29bfb9f3c2a3..bd62be510a9431871c72e6700188e496cde1b7c7 100644 (file)
@@ -2678,10 +2678,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);