Linux NFS development
 help / color / mirror / Atom feed
* [PATCH] nfs: local_lock: handle async processing of F_SETLK with FL_SLEEP
@ 2021-12-27 10:45 Vasily Averin
  2021-12-27 12:59 ` kernel test robot
  2022-01-06 10:29 ` [PATCH] " Dan Carpenter
  0 siblings, 2 replies; 5+ messages in thread
From: Vasily Averin @ 2021-12-27 10:45 UTC (permalink / raw)
  To: Trond Myklebust, Anna Schumaker; +Cc: kernel, linux-nfs, linux-kernel

nfsd and lockd use F_SETLK cmd with the FL_SLEEP flag set to request
asynchronous processing of blocking locks.

Currently nfs mounted with 'local_lock' option use locks_lock_file_wait()
function blocked on such requests.

To handle such requests properly, non-blocking posix_file_lock()
function should be used instead.

https://bugzilla.kernel.org/show_bug.cgi?id=215383
Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
---
 fs/nfs/file.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/fs/nfs/file.c b/fs/nfs/file.c
index 24e7dccce355..c9c974ee2f43 100644
--- a/fs/nfs/file.c
+++ b/fs/nfs/file.c
@@ -769,9 +769,11 @@ do_setlk(struct file *filp, int cmd, struct file_lock *fl, int is_local)
 	 */
 	if (!is_local)
 		status = NFS_PROTO(inode)->lock(filp, cmd, fl);
+	else if ((fl->fl_flags && FL_SLEEP) && IS_SETLK(cmd))
+		status = posix_lock_file(filp, fl, NULL);
 	else
 		status = locks_lock_file_wait(filp, fl);
-	if (status < 0)
+	if (status)
 		goto out;
 
 	/*
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-01-06 10:30 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-12-27 10:45 [PATCH] nfs: local_lock: handle async processing of F_SETLK with FL_SLEEP Vasily Averin
2021-12-27 12:59 ` kernel test robot
2021-12-27 15:50   ` [PATCH v2] " Vasily Averin
2021-12-28  1:00     ` Vasily Averin
2022-01-06 10:29 ` [PATCH] " Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox