2023-06-08 09:12:18

by Jiachen Zhang

[permalink] [raw]
Subject: [PATCH 0/2] fuse: fixes for remote locking

Hi all,

This patchset fixes some small issues of fuse remoting locking.

The first patch fixes the missing automatic unlock of fcntl(2) OFD lock.
The second patch remove some deadcode for clearness.

Thanks,
Jiachen

Jiachen Zhang (2):
fuse: support unlock remote OFD locks on file release
fuse: remove an unnecessary if statement

fs/fuse/file.c | 21 ++++++++++++++-------
fs/fuse/fuse_i.h | 2 +-
2 files changed, 15 insertions(+), 8 deletions(-)

--
2.20.1



2023-06-08 09:17:24

by Jiachen Zhang

[permalink] [raw]
Subject: [PATCH 2/2] fuse: remove an unnecessary if statement

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 <[email protected]>
---
fs/fuse/file.c | 4 ----
1 file changed, 4 deletions(-)

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);

--
2.20.1


2024-03-06 09:14:51

by Miklos Szeredi

[permalink] [raw]
Subject: Re: [PATCH 2/2] fuse: remove an unnecessary if statement

On Thu, 8 Jun 2023 at 10:47, Jiachen Zhang
<[email protected]> 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 <[email protected]>

Applied, thanks.

Miklos