]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
nfsd: use correct loop termination in nfsd4_revoke_states()
authorNeilBrown <neil@brown.name>
Sun, 14 Dec 2025 21:07:28 +0000 (08:07 +1100)
committerChuck Lever <chuck.lever@oracle.com>
Fri, 2 Jan 2026 18:49:38 +0000 (13:49 -0500)
The loop in nfsd4_revoke_states() stops one too early because
the end value given is CLIENT_HASH_MASK where it should be
CLIENT_HASH_SIZE.

This means that an admin request to drop all locks for a filesystem will
miss locks held by clients which hash to the maximum possible hash value.

Fixes: 1ac3629bf012 ("nfsd: prepare for supporting admin-revocation of state")
Cc: stable@vger.kernel.org
Signed-off-by: NeilBrown <neil@brown.name>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
fs/nfsd/nfs4state.c

index a1dccce8b99c2865bbab57b551dd8a326490d52e..18b3688e0f198892023db4e4839e404dea5fb19f 100644 (file)
@@ -1780,7 +1780,7 @@ void nfsd4_revoke_states(struct net *net, struct super_block *sb)
        sc_types = SC_TYPE_OPEN | SC_TYPE_LOCK | SC_TYPE_DELEG | SC_TYPE_LAYOUT;
 
        spin_lock(&nn->client_lock);
-       for (idhashval = 0; idhashval < CLIENT_HASH_MASK; idhashval++) {
+       for (idhashval = 0; idhashval < CLIENT_HASH_SIZE; idhashval++) {
                struct list_head *head = &nn->conf_id_hashtbl[idhashval];
                struct nfs4_client *clp;
        retry: