]> git.karo-electronics.de Git - linux-beck.git/commitdiff
nfsd: Ensure that the laundromat unhashes the client before releasing locks
authorTrond Myklebust <trond.myklebust@primarydata.com>
Wed, 30 Jul 2014 12:27:03 +0000 (08:27 -0400)
committerJ. Bruce Fields <bfields@redhat.com>
Fri, 1 Aug 2014 20:28:18 +0000 (16:28 -0400)
If we leave the client on the confirmed/unconfirmed tables, and leave
the sessions visible on the sessionid_hashtbl, then someone might
find them before we've had a chance to destroy them.

Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
fs/nfsd/nfs4state.c

index cb630db015b0c9710863d1bbf14ab437e75a0a2c..a374592e7dcfc98bb51f35d8c64e4c59b0292715 100644 (file)
@@ -4125,13 +4125,15 @@ nfs4_laundromat(struct nfsd_net *nn)
                                clp->cl_clientid.cl_id);
                        continue;
                }
-               list_move(&clp->cl_lru, &reaplist);
+               unhash_client_locked(clp);
+               list_add(&clp->cl_lru, &reaplist);
        }
        spin_unlock(&nn->client_lock);
        list_for_each_safe(pos, next, &reaplist) {
                clp = list_entry(pos, struct nfs4_client, cl_lru);
                dprintk("NFSD: purging unused client (clientid %08x)\n",
                        clp->cl_clientid.cl_id);
+               list_del_init(&clp->cl_lru);
                expire_client(clp);
        }
        spin_lock(&state_lock);