nfsd4: fix minor memory leak
[safe/jmp/linux-2.6] / fs / nfsd / nfs4callback.c
index 89f23ed..4bc22c7 100644 (file)
@@ -1,6 +1,4 @@
 /*
- *  linux/fs/nfsd/nfs4callback.c
- *
  *  Copyright (c) 2001 The Regents of the University of Michigan.
  *  All rights reserved.
  *
  *  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#include <linux/module.h>
-#include <linux/list.h>
-#include <linux/inet.h>
-#include <linux/errno.h>
-#include <linux/delay.h>
-#include <linux/sched.h>
-#include <linux/kthread.h>
-#include <linux/sunrpc/xdr.h>
-#include <linux/sunrpc/svc.h>
 #include <linux/sunrpc/clnt.h>
-#include <linux/sunrpc/svcsock.h>
-#include <linux/nfsd/nfsd.h>
-#include <linux/nfsd/state.h>
-#include <linux/sunrpc/sched.h>
-#include <linux/nfs4.h>
+#include "nfsd.h"
+#include "state.h"
 
 #define NFSDDBG_FACILITY                NFSDDBG_PROC
 
@@ -483,7 +469,7 @@ int setup_callback_client(struct nfs4_client *clp)
                .to_retries     = 0,
        };
        struct rpc_create_args args = {
-               .protocol       = IPPROTO_TCP,
+               .protocol       = XPRT_TRANSPORT_TCP,
                .address        = (struct sockaddr *) &cb->cb_addr,
                .addrsize       = cb->cb_addrlen,
                .timeout        = &timeparms,
@@ -498,7 +484,10 @@ int setup_callback_client(struct nfs4_client *clp)
 
        if (!clp->cl_principal && (clp->cl_flavor >= RPC_AUTH_GSS_KRB5))
                return -EINVAL;
-
+       if (cb->cb_minorversion) {
+               args.bc_xprt = clp->cl_cb_xprt;
+               args.protocol = XPRT_TRANSPORT_BC_TCP;
+       }
        /* Create RPC client */
        client = rpc_create(&args);
        if (IS_ERR(client)) {
@@ -536,6 +525,8 @@ static struct rpc_cred *callback_cred;
 
 int set_callback_cred(void)
 {
+       if (callback_cred)
+               return 0;
        callback_cred = rpc_lookup_machine_cred();
        if (!callback_cred)
                return -ENOMEM;
@@ -553,7 +544,8 @@ void do_probe_callback(struct nfs4_client *clp)
        };
        int status;
 
-       status = rpc_call_async(cb->cb_client, &msg, RPC_TASK_SOFT,
+       status = rpc_call_async(cb->cb_client, &msg,
+                               RPC_TASK_SOFT | RPC_TASK_SOFTCONN,
                                &nfsd4_cb_probe_ops, (void *)clp);
        if (status) {
                warn_no_callback_path(clp, status);