Commit e498daa81295d02f7359af313c2b7f87e1062207
1 parent
a4ee8d978e
Exists in
smarc-l5.0.0_1.0.0-ga
and in
5 other branches
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
Showing 1 changed file with 6 additions and 8 deletions Side-by-side Diff
fs/lockd/mon.c
... | ... | @@ -124,18 +124,16 @@ |
124 | 124 | static void nsm_client_put(struct net *net) |
125 | 125 | { |
126 | 126 | struct lockd_net *ln = net_generic(net, lockd_net_id); |
127 | - struct rpc_clnt *clnt = ln->nsm_clnt; | |
128 | - int shutdown = 0; | |
127 | + struct rpc_clnt *clnt = NULL; | |
129 | 128 | |
130 | 129 | spin_lock(&ln->nsm_clnt_lock); |
131 | - if (ln->nsm_users) { | |
132 | - if (--ln->nsm_users) | |
133 | - ln->nsm_clnt = NULL; | |
134 | - shutdown = !ln->nsm_users; | |
130 | + ln->nsm_users--; | |
131 | + if (ln->nsm_users == 0) { | |
132 | + clnt = ln->nsm_clnt; | |
133 | + ln->nsm_clnt = NULL; | |
135 | 134 | } |
136 | 135 | spin_unlock(&ln->nsm_clnt_lock); |
137 | - | |
138 | - if (shutdown) | |
136 | + if (clnt != NULL) | |
139 | 137 | rpc_shutdown_client(clnt); |
140 | 138 | } |
141 | 139 |