linux 2.6.16.38 w/ vs2.0.3-rc1
[linux-2.6.git] / fs / lockd / host.c
index 7b4020e..82f7a0b 100644 (file)
@@ -110,7 +110,6 @@ nlm_lookup_host(int server, struct sockaddr_in *sin,
        host->h_addr.sin_port = 0;      /* ouch! */
        host->h_version    = version;
        host->h_proto      = proto;
-       host->h_authflavor = RPC_AUTH_UNIX;
        host->h_rpcclnt    = NULL;
        init_MUTEX(&host->h_sema);
        host->h_nextrebind = jiffies + NLM_HOST_REBIND;
@@ -174,34 +173,29 @@ nlm_bind_host(struct nlm_host *host)
 
        /* If we've already created an RPC client, check whether
         * RPC rebind is required
-        * Note: why keep rebinding if we're on a tcp connection?
         */
        if ((clnt = host->h_rpcclnt) != NULL) {
                xprt = clnt->cl_xprt;
-               if (!xprt->stream && time_after_eq(jiffies, host->h_nextrebind)) {
-                       clnt->cl_port = 0;
+               if (time_after_eq(jiffies, host->h_nextrebind)) {
+                       rpc_force_rebind(clnt);
                        host->h_nextrebind = jiffies + NLM_HOST_REBIND;
                        dprintk("lockd: next rebind in %ld jiffies\n",
                                        host->h_nextrebind - jiffies);
                }
        } else {
                xprt = xprt_create_proto(host->h_proto, &host->h_addr, NULL);
-               if (IS_ERR(xprt)) {
-                       dprintk("lockd: xprt_create_proto failed: %ld\n", PTR_ERR(xprt));
+               if (IS_ERR(xprt))
                        goto forgetit;
-               }
+
                xprt_set_timeout(&xprt->timeout, 5, nlmsvc_timeout);
+               xprt->resvport = 1;     /* NLM requires a reserved port */
 
+               /* Existing NLM servers accept AUTH_UNIX only */
                clnt = rpc_create_client(xprt, host->h_name, &nlm_program,
-                                       host->h_version, host->h_authflavor);
-               if (IS_ERR(clnt)) {
-                       xprt_destroy(xprt);
-                       dprintk("lockd: rpc_create_client failed: %ld\n", PTR_ERR(clnt));
+                                       host->h_version, RPC_AUTH_UNIX);
+               if (IS_ERR(clnt))
                        goto forgetit;
-               }
                clnt->cl_autobind = 1;  /* turn on pmap queries */
-               xprt->nocong = 1;       /* No congestion control for NLM */
-               xprt->resvport = 1;     /* NLM requires a reserved port */
 
                host->h_rpcclnt = clnt;
        }
@@ -223,7 +217,7 @@ nlm_rebind_host(struct nlm_host *host)
 {
        dprintk("lockd: rebind host %s\n", host->h_name);
        if (host->h_rpcclnt && time_after_eq(jiffies, host->h_nextrebind)) {
-               host->h_rpcclnt->cl_port = 0;
+               rpc_force_rebind(host->h_rpcclnt);
                host->h_nextrebind = jiffies + NLM_HOST_REBIND;
        }
 }