LOCKD: Clear ln->nsm_clnt only when ln->nsm_users is zero
The current code is clearing it in all cases _except_ when zero. Reported-by: Stanislav Kinsbursky <skinsbursky@parallels.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com> Cc: stable@vger.kernel.org
This commit is contained in:
parent
a4ee8d978e
commit
e498daa812
|
@ -124,18 +124,16 @@ out:
|
||||||
static void nsm_client_put(struct net *net)
|
static void nsm_client_put(struct net *net)
|
||||||
{
|
{
|
||||||
struct lockd_net *ln = net_generic(net, lockd_net_id);
|
struct lockd_net *ln = net_generic(net, lockd_net_id);
|
||||||
struct rpc_clnt *clnt = ln->nsm_clnt;
|
struct rpc_clnt *clnt = NULL;
|
||||||
int shutdown = 0;
|
|
||||||
|
|
||||||
spin_lock(&ln->nsm_clnt_lock);
|
spin_lock(&ln->nsm_clnt_lock);
|
||||||
if (ln->nsm_users) {
|
ln->nsm_users--;
|
||||||
if (--ln->nsm_users)
|
if (ln->nsm_users == 0) {
|
||||||
ln->nsm_clnt = NULL;
|
clnt = ln->nsm_clnt;
|
||||||
shutdown = !ln->nsm_users;
|
ln->nsm_clnt = NULL;
|
||||||
}
|
}
|
||||||
spin_unlock(&ln->nsm_clnt_lock);
|
spin_unlock(&ln->nsm_clnt_lock);
|
||||||
|
if (clnt != NULL)
|
||||||
if (shutdown)
|
|
||||||
rpc_shutdown_client(clnt);
|
rpc_shutdown_client(clnt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue