]> git.baikalelectronics.ru Git - kernel.git/commit
nfs: block notification on fs with its own ->lock
authorJ. Bruce Fields <bfields@redhat.com>
Thu, 16 Dec 2021 17:20:13 +0000 (12:20 -0500)
committerChuck Lever <chuck.lever@oracle.com>
Sat, 8 Jan 2022 19:42:01 +0000 (14:42 -0500)
commit17d5907f693065f2358d20568334c9d6a9c691e6
tree62ba8dfb92bbfbd803f461e11497c8600b87d61f
parenteb6efa5c0829db429526a0b3173b217e6f16f3f4
nfs: block notification on fs with its own ->lock

NFSv4.1 supports an optional lock notification feature which notifies
the client when a lock comes available.  (Normally NFSv4 clients just
poll for locks if necessary.)  To make that work, we need to request a
blocking lock from the filesystem.

We turned that off for NFS in commit 5e3389759e2f ("nfs: don't atempt
blocking locks on nfs reexports") [sic] because it actually blocks the
nfsd thread while waiting for the lock.

Thanks to Vasily Averin for pointing out that NFS isn't the only
filesystem with that problem.

Any filesystem that leaves ->lock NULL will use posix_lock_file(), which
does the right thing.  Simplest is just to assume that any filesystem
that defines its own ->lock is not safe to request a blocking lock from.

So, this patch mostly reverts commit 5e3389759e2f ("nfs: don't atempt
blocking locks on nfs reexports") [sic] and commit 585c4a2c12c4 ("lockd:
don't attempt blocking locks on nfs reexports"), and instead uses a
check of ->lock (Vasily's suggestion) to decide whether to support
blocking lock notifications on a given filesystem.  Also add a little
documentation.

Perhaps someday we could add back an export flag later to allow
filesystems with "good" ->lock methods to support blocking lock
notifications.

Reported-by: Vasily Averin <vvs@virtuozzo.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
[ cel: Description rewritten to address checkpatch nits ]
[ cel: Fixed warning when SUNRPC debugging is disabled ]
[ cel: Fixed NULL check ]
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Reviewed-by: Vasily Averin <vvs@virtuozzo.com>
fs/lockd/svclock.c
fs/nfs/export.c
fs/nfsd/nfs4state.c
include/linux/exportfs.h
include/linux/lockd/lockd.h