nfs: don't atempt blocking locks on nfs reexports
authorJ. Bruce Fields <bfields@redhat.com>
Fri, 20 Aug 2021 21:02:04 +0000 (17:02 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 18 Sep 2021 11:42:18 +0000 (13:42 +0200)
commita0cfe8cbbe0935381b13ee364560266becff63cf
treeab5925b663c8f41ab7d2accc142802d9cee8a06b
parent785fff421015aa54b5ebb62bed16b859c4ab4982
nfs: don't atempt blocking locks on nfs reexports

[ Upstream commit f657f8eef3ff870552c9fd2839e0061046f44618 ]

NFS implements blocking locks by blocking inside its lock method.  In
the reexport case, this blocks the nfs server thread, which could lead
to deadlocks since an nfs server thread might be required to unlock the
conflicting lock.  It also causes a crash, since the nfs server thread
assumes it can free the lock when its lm_notify lock callback is called.

Ideal would be to make the nfs lock method return without blocking in
this case, but for now it works just not to attempt blocking locks.  The
difference is just that the original client will have to poll (as it
does in the v4.0 case) instead of getting a callback when the lock's
available.

Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Acked-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/nfs/export.c
fs/nfsd/nfs4state.c
include/linux/exportfs.h