]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
nfsd4: Fix forced-expiry locking
authorJ. Bruce Fields <bfields@redhat.com>
Thu, 12 Aug 2021 20:41:43 +0000 (16:41 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 15 Sep 2021 07:50:41 +0000 (09:50 +0200)
[ Upstream commit f7104cc1a9159cd0d3e8526cb638ae0301de4b61 ]

This should use the network-namespace-wide client_lock, not the
per-client cl_lock.

You shouldn't see any bugs unless you're actually using the
forced-expiry interface introduced by 89c905beccbb.

Fixes: 89c905beccbb "nfsd: allow forced expiration of NFSv4 clients"
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/nfsd/nfs4state.c

index 80e394a2e3fd706a91a1868c0037a15302cb4ede..142aac9b63a896a75cf4885c43164d59cb425529 100644 (file)
@@ -2646,9 +2646,9 @@ static void force_expire_client(struct nfs4_client *clp)
        struct nfsd_net *nn = net_generic(clp->net, nfsd_net_id);
        bool already_expired;
 
-       spin_lock(&clp->cl_lock);
+       spin_lock(&nn->client_lock);
        clp->cl_time = 0;
-       spin_unlock(&clp->cl_lock);
+       spin_unlock(&nn->client_lock);
 
        wait_event(expiry_wq, atomic_read(&clp->cl_rpc_users) == 0);
        spin_lock(&nn->client_lock);