Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e498daa8 authored by Trond Myklebust's avatar Trond Myklebust
Browse files

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: default avatarStanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
Cc: stable@vger.kernel.org
parent a4ee8d97
Loading
Loading
Loading
Loading
+6 −8
Original line number Diff line number Diff line
@@ -124,18 +124,16 @@ out:
static void nsm_client_put(struct net *net)
{
	struct lockd_net *ln = net_generic(net, lockd_net_id);
	struct rpc_clnt	*clnt = ln->nsm_clnt;
	int shutdown = 0;
	struct rpc_clnt	*clnt = NULL;

	spin_lock(&ln->nsm_clnt_lock);
	if (ln->nsm_users) {
		if (--ln->nsm_users)
	ln->nsm_users--;
	if (ln->nsm_users == 0) {
		clnt = ln->nsm_clnt;
		ln->nsm_clnt = NULL;
		shutdown = !ln->nsm_users;
	}
	spin_unlock(&ln->nsm_clnt_lock);

	if (shutdown)
	if (clnt != NULL)
		rpc_shutdown_client(clnt);
}