[PATCH] fuse: fix dereferencing dentry parent
[powerpc.git] / fs / lockd / svc.c
index 448768b..6341392 100644 (file)
@@ -33,6 +33,7 @@
 #include <linux/sunrpc/svcsock.h>
 #include <net/ip.h>
 #include <linux/lockd/lockd.h>
+#include <linux/lockd/sm_inter.h>
 #include <linux/nfs.h>
 
 #define NLMDBG_FACILITY                NLMDBG_SVC
@@ -61,6 +62,7 @@ static DECLARE_WAIT_QUEUE_HEAD(lockd_exit);
 static unsigned long           nlm_grace_period;
 static unsigned long           nlm_timeout = LOCKD_DFLT_TIMEO;
 static int                     nlm_udpport, nlm_tcpport;
+int                            nsm_use_hostnames = 0;
 
 /*
  * Constants needed for the sysctl interface.
@@ -253,16 +255,12 @@ lockd_up(int proto) /* Maybe add a 'family' option when IPv6 is supported ?? */
        int                     error = 0;
 
        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 +268,7 @@ lockd_up(int proto) /* Maybe add a 'family' option when IPv6 is supported ?? */
         * 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 +300,8 @@ lockd_up(int proto) /* Maybe add a 'family' option when IPv6 is supported ?? */
 destroy_and_out:
        svc_destroy(serv);
 out:
+       if (!error)
+               nlmsvc_users++;
        mutex_unlock(&nlmsvc_mutex);
        return error;
 }
@@ -397,6 +397,22 @@ static ctl_table nlm_sysctls[] = {
                .extra1         = (int *) &nlm_port_min,
                .extra2         = (int *) &nlm_port_max,
        },
+       {
+               .ctl_name       = CTL_UNNUMBERED,
+               .procname       = "nsm_use_hostnames",
+               .data           = &nsm_use_hostnames,
+               .maxlen         = sizeof(int),
+               .mode           = 0644,
+               .proc_handler   = &proc_dointvec,
+       },
+       {
+               .ctl_name       = CTL_UNNUMBERED,
+               .procname       = "nsm_local_state",
+               .data           = &nsm_local_state,
+               .maxlen         = sizeof(int),
+               .mode           = 0644,
+               .proc_handler   = &proc_dointvec,
+       },
        { .ctl_name = 0 }
 };
 
@@ -485,6 +501,7 @@ module_param_call(nlm_udpport, param_set_port, param_get_int,
                  &nlm_udpport, 0644);
 module_param_call(nlm_tcpport, param_set_port, param_get_int,
                  &nlm_tcpport, 0644);
+module_param(nsm_use_hostnames, bool, 0644);
 
 /*
  * Initialising and terminating the module.