summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2012-10-24 08:53:35 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-10-31 10:09:57 -0700
commitcb499284d1cf7de50b85fcfb3248bae2db090d14 (patch)
treeec4fa78b53de472b63fe88bfe4041840c38e4199 /fs
parenteeaeb30f888f0872c029b441a69d67f43e712c80 (diff)
LOCKD: Clear ln->nsm_clnt only when ln->nsm_users is zero
commit e498daa81295d02f7359af313c2b7f87e1062207 upstream. 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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/lockd/mon.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/fs/lockd/mon.c b/fs/lockd/mon.c
index fe695603e395..3d7e09bcc0e9 100644
--- a/fs/lockd/mon.c
+++ b/fs/lockd/mon.c
@@ -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_clnt = NULL;
- shutdown = !ln->nsm_users;
+ ln->nsm_users--;
+ if (ln->nsm_users == 0) {
+ clnt = ln->nsm_clnt;
+ ln->nsm_clnt = NULL;
}
spin_unlock(&ln->nsm_clnt_lock);
-
- if (shutdown)
+ if (clnt != NULL)
rpc_shutdown_client(clnt);
}