From: Trond Myklebust Date: Wed, 30 Jul 2014 12:27:03 +0000 (-0400) Subject: nfsd: Ensure that the laundromat unhashes the client before releasing locks X-Git-Tag: v3.17-rc1~58^2~37 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=4864af97e02d1ef6aa78963195a64ed2ed7752c3;p=karo-tx-linux.git nfsd: Ensure that the laundromat unhashes the client before releasing locks 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 Signed-off-by: J. Bruce Fields --- diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index cb630db015b0..a374592e7dcf 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c @@ -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);