[PATCH] fuse: async processing of F_SETLK with FL_SLEEP flag

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



kernel export thread (nfsd/lockd/ksmbd) use F_SETLK cmd with set FL_SLEEP
flag to request asynchronous processing of blocking locks.
Fuse does not support async processing and should drop FL_SLEEP flag
to avoid execution of blocking FUSE_SETLKW request.
Dropped FL_SLEEP flag should be restored back, because it can be used
in caller, at least in nfsd4_lock() does it actually.

https://bugzilla.kernel.org/show_bug.cgi?id=215383
Signed-off-by: Vasily Averin <vvs@xxxxxxxxxxxxx>
---
 fs/fuse/file.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index 06e0d7fa86f3..54a9a5d660a6 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -2540,8 +2540,17 @@ static int fuse_file_lock(struct file *file, int cmd, struct file_lock *fl)
 	} else {
 		if (fc->no_lock)
 			err = posix_lock_file(file, fl, NULL);
-		else
+		else {
+			bool async = (fl->fl_flags & FL_SLEEP) && IS_SETLK(cmd);
+
+			if (async)
+				fl->fl_flags &= ~FL_SLEEP;
+
 			err = fuse_setlk(file, fl, 0);
+
+			if (async)
+				fl->fl_flags |= FL_SLEEP;
+		}
 	}
 	return err;
 }
-- 
2.25.1




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux