* [PATCH] cifs: handle async processing of F_SETLK with FL_SLEEP flag
@ 2021-12-23 18:00 Vasily Averin
0 siblings, 0 replies; only message in thread
From: Vasily Averin @ 2021-12-23 18:00 UTC (permalink / raw)
To: Steve French; +Cc: kernel, linux-cifs, samba-technical, linux-kernel
kernel export thread (nfsd/lockd/ksmbd) uses F_SETLK cmd with the
FL_SLEEP flag set to request asynchronous processing of blocking locks.
Currently cifs does not support such requests, it ignores F_SETLK cmd
and handles the FL_SLEEP flag as an usual blocking lock request.
To work around the problem let's detect such request, drop FL_SLEEP and
wait_flag flags before cifs_setlk() execution.
Dropped FL_SLEEP flag should be restored back because some calling function
(nfsd4_lock) require it.
https://bugzilla.kernel.org/show_bug.cgi?id=215383
Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
---
fs/cifs/file.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index 9fee3af83a73..6835458ee845 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -1847,6 +1847,7 @@ int cifs_lock(struct file *file, int cmd, struct file_lock *flock)
int lock = 0, unlock = 0;
bool wait_flag = false;
bool posix_lck = false;
+ bool async = false;
struct cifs_sb_info *cifs_sb;
struct cifs_tcon *tcon;
struct cifsFileInfo *cfile;
@@ -1890,8 +1891,17 @@ int cifs_lock(struct file *file, int cmd, struct file_lock *flock)
return -EOPNOTSUPP;
}
+ async = (flock->fl_flags & FL_SLEEP) && IS_SETLK(cmd);
+ if (async) {
+ flock->fl_flags &= ~FL_SLEEP;
+ wait_flag = false;
+ }
+
rc = cifs_setlk(file, flock, type, wait_flag, posix_lck, lock, unlock,
xid);
+ if (async)
+ flock->fl_flags |= FL_SLEEP;
+
free_xid(xid);
return rc;
}
--
2.25.1
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-12-23 18:00 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-23 18:00 [PATCH] cifs: handle async processing of F_SETLK with FL_SLEEP flag Vasily Averin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®