Messages in this thread Patch in this message | | | From | Vasily Averin <> | Subject | [PATCH] v9fs: handle async processing of F_SETLK with FL_SLEEP flag | Date | Thu, 23 Dec 2021 21:21:23 +0300 |
| |
kernel export thread (nfsd/lockd/ksmbd) uses F_SETLK cmd with the FL_SLEEP flag set to request asynchronous processing of blocking locks.
Currently v9fs does not support such requests and calls blocking locks_lock_file_wait() function.
To work around the problem let's detect such request, drop FL_SLEEP before execution of potentially blocking functions.
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/9p/vfs_file.c | 7 +++++++ 1 file changed, 7 insertions(+)
diff --git a/fs/9p/vfs_file.c b/fs/9p/vfs_file.c index 612e297f3763..81c98afdbb32 100644 --- a/fs/9p/vfs_file.c +++ b/fs/9p/vfs_file.c @@ -135,6 +135,7 @@ static int v9fs_file_do_lock(struct file *filp, int cmd, struct file_lock *fl) int res = 0; unsigned char fl_type; struct v9fs_session_info *v9ses; + bool async = false; fid = filp->private_data; BUG_ON(fid == NULL); @@ -142,6 +143,10 @@ static int v9fs_file_do_lock(struct file *filp, int cmd, struct file_lock *fl) if ((fl->fl_flags & FL_POSIX) != FL_POSIX) BUG(); + async = (fl->fl_flags & FL_SLEEP) && IS_SETLK(cmd); + if (async) + fl->fl_flags &= ~FL_SLEEP; + res = locks_lock_file_wait(filp, fl); if (res < 0) goto out; @@ -230,6 +235,8 @@ static int v9fs_file_do_lock(struct file *filp, int cmd, struct file_lock *fl) if (flock.client_id != fid->clnt->name) kfree(flock.client_id); out: + if (async) + fl->fl_flags |= FL_SLEEP; return res; } -- 2.25.1
| |