OSDN Git Service

nfsd: have nfsd4_lock use blocking locks for v4.1+ locks
authorJeff Layton <jlayton@redhat.com>
Fri, 16 Sep 2016 20:28:24 +0000 (16:28 -0400)
committerJ. Bruce Fields <bfields@redhat.com>
Mon, 26 Sep 2016 19:20:36 +0000 (15:20 -0400)
commit76d348fadff52e8ad10e7f587a4560df79a5fefe
tree24b7a65f5fac106041d8bed8459b2a9a5f64bc79
parenta188620ebd294b18d8da93f4b2a307d484e7bd27
nfsd: have nfsd4_lock use blocking locks for v4.1+ locks

Create a new per-lockowner+per-inode structure that contains a
file_lock. Have nfsd4_lock add this structure to the lockowner's list
prior to setting the lock. Then call the vfs and request a blocking lock
(by setting FL_SLEEP). If we get anything besides FILE_LOCK_DEFERRED
back, then we dequeue the block structure and free it. When the next
lock request comes in, we'll look for an existing block for the same
filehandle and dequeue and reuse it if there is one.

When the lock comes free (a'la an lm_notify call), we dequeue it
from the lockowner's list and kick off a CB_NOTIFY_LOCK callback to
inform the client that it should retry the lock request.

Signed-off-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
fs/nfsd/nfs4state.c
fs/nfsd/state.h