[PATCH] knfsd: Correctly handle error condition from lockd_up
If lockd_up fails - what should we expect? Do we have to later call
lockd_down?
Well the nfs client thinks "no", the nfs server thinks "yes". lockd thinks
"yes".
The only answer that really makes sense is "no" !!
So:
Make lockd_up only increment nlmsvc_users on success.
Make nfsd handle errors from lockd_up properly.
Make sure lockd_up(0) never fails when lockd is running
so that the 'reclaimer' call to lockd_up doesn't need to
be error checked.
Cc: "J. Bruce Fields" <bfields@fieldses.org>
Signed-off-by: Neil Brown <neilb@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
diff --git a/fs/lockd/svc.c b/fs/lockd/svc.c
index 448768b..3cc369e 100644
--- a/fs/lockd/svc.c
+++ b/fs/lockd/svc.c
@@ -254,15 +254,11 @@
mutex_lock(&nlmsvc_mutex);
/*
- * Unconditionally increment the user count ... this is
- * the number of clients who _want_ a lockd process.
- */
- nlmsvc_users++;
- /*
* Check whether we're already up and running.
*/
if (nlmsvc_pid) {
- error = make_socks(nlmsvc_serv, proto);
+ if (proto)
+ error = make_socks(nlmsvc_serv, proto);
goto out;
}
@@ -270,7 +266,7 @@
* Sanity check: if there's no pid,
* we should be the first user ...
*/
- if (nlmsvc_users > 1)
+ if (nlmsvc_users)
printk(KERN_WARNING
"lockd_up: no pid, %d users??\n", nlmsvc_users);
@@ -302,6 +298,8 @@
destroy_and_out:
svc_destroy(serv);
out:
+ if (!error)
+ nlmsvc_users++;
mutex_unlock(&nlmsvc_mutex);
return error;
}