Skip to content

Commit

Permalink
nfs4: handle async processing of F_SETLK with FL_SLEEP
Browse files Browse the repository at this point in the history
nfsd and lockd use F_SETLK cmd with the FL_SLEEP flag set to request
asynchronous processing of blocking locks.

Currently nfs4 use locks_lock_inode_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>
  • Loading branch information
vaverin authored and intel-lab-lkp committed Dec 27, 2021
1 parent 064a917 commit 7ae55d3
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions fs/nfs/nfs4proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -7199,8 +7199,11 @@ static int _nfs4_proc_setlk(struct nfs4_state *state, int cmd, struct file_lock
int status;

request->fl_flags |= FL_ACCESS;
status = locks_lock_inode_wait(state->inode, request);
if (status < 0)
if ((request->fl_flags && FL_SLEEP) && IS_SETLK(cmd))
status = posix_lock_file(request->fl_file, request, NULL);
else
status = locks_lock_inode_wait(state->inode, request);
if (status)
goto out;
mutex_lock(&sp->so_delegreturn_mutex);
down_read(&nfsi->rwsem);
Expand Down

0 comments on commit 7ae55d3

Please sign in to comment.