aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/nfs/client.c9
-rw-r--r--include/linux/sunrpc/clnt.h2
-rw-r--r--net/sunrpc/clnt.c2
-rw-r--r--net/sunrpc/xprt.c10
4 files changed, 20 insertions, 3 deletions
diff --git a/fs/nfs/client.c b/fs/nfs/client.c
index a3191f023490..c46e94fed9eb 100644
--- a/fs/nfs/client.c
+++ b/fs/nfs/client.c
@@ -394,7 +394,8 @@ static void nfs_init_timeout_values(struct rpc_timeout *to, int proto,
394static int nfs_create_rpc_client(struct nfs_client *clp, int proto, 394static int nfs_create_rpc_client(struct nfs_client *clp, int proto,
395 unsigned int timeo, 395 unsigned int timeo,
396 unsigned int retrans, 396 unsigned int retrans,
397 rpc_authflavor_t flavor) 397 rpc_authflavor_t flavor,
398 int flags)
398{ 399{
399 struct rpc_timeout timeparms; 400 struct rpc_timeout timeparms;
400 struct rpc_clnt *clnt = NULL; 401 struct rpc_clnt *clnt = NULL;
@@ -407,6 +408,7 @@ static int nfs_create_rpc_client(struct nfs_client *clp, int proto,
407 .program = &nfs_program, 408 .program = &nfs_program,
408 .version = clp->rpc_ops->version, 409 .version = clp->rpc_ops->version,
409 .authflavor = flavor, 410 .authflavor = flavor,
411 .flags = flags,
410 }; 412 };
411 413
412 if (!IS_ERR(clp->cl_rpcclient)) 414 if (!IS_ERR(clp->cl_rpcclient))
@@ -548,7 +550,7 @@ static int nfs_init_client(struct nfs_client *clp, const struct nfs_mount_data *
548 * - RFC 2623, sec 2.3.2 550 * - RFC 2623, sec 2.3.2
549 */ 551 */
550 error = nfs_create_rpc_client(clp, proto, data->timeo, data->retrans, 552 error = nfs_create_rpc_client(clp, proto, data->timeo, data->retrans,
551 RPC_AUTH_UNIX); 553 RPC_AUTH_UNIX, 0);
552 if (error < 0) 554 if (error < 0)
553 goto error; 555 goto error;
554 nfs_mark_client_ready(clp, NFS_CS_READY); 556 nfs_mark_client_ready(clp, NFS_CS_READY);
@@ -868,7 +870,8 @@ static int nfs4_init_client(struct nfs_client *clp,
868 /* Check NFS protocol revision and initialize RPC op vector */ 870 /* Check NFS protocol revision and initialize RPC op vector */
869 clp->rpc_ops = &nfs_v4_clientops; 871 clp->rpc_ops = &nfs_v4_clientops;
870 872
871 error = nfs_create_rpc_client(clp, proto, timeo, retrans, authflavour); 873 error = nfs_create_rpc_client(clp, proto, timeo, retrans, authflavour,
874 RPC_CLNT_CREATE_DISCRTRY);
872 if (error < 0) 875 if (error < 0)
873 goto error; 876 goto error;
874 memcpy(clp->cl_ipaddr, ip_addr, sizeof(clp->cl_ipaddr)); 877 memcpy(clp->cl_ipaddr, ip_addr, sizeof(clp->cl_ipaddr));
diff --git a/include/linux/sunrpc/clnt.h b/include/linux/sunrpc/clnt.h
index a1be89deb3af..c7a78eef2b4f 100644
--- a/include/linux/sunrpc/clnt.h
+++ b/include/linux/sunrpc/clnt.h
@@ -40,6 +40,7 @@ struct rpc_clnt {
40 40
41 unsigned int cl_softrtry : 1,/* soft timeouts */ 41 unsigned int cl_softrtry : 1,/* soft timeouts */
42 cl_intr : 1,/* interruptible */ 42 cl_intr : 1,/* interruptible */
43 cl_discrtry : 1,/* disconnect before retry */
43 cl_autobind : 1,/* use getport() */ 44 cl_autobind : 1,/* use getport() */
44 cl_oneshot : 1,/* dispose after use */ 45 cl_oneshot : 1,/* dispose after use */
45 cl_dead : 1;/* abandoned */ 46 cl_dead : 1;/* abandoned */
@@ -111,6 +112,7 @@ struct rpc_create_args {
111#define RPC_CLNT_CREATE_ONESHOT (1UL << 3) 112#define RPC_CLNT_CREATE_ONESHOT (1UL << 3)
112#define RPC_CLNT_CREATE_NONPRIVPORT (1UL << 4) 113#define RPC_CLNT_CREATE_NONPRIVPORT (1UL << 4)
113#define RPC_CLNT_CREATE_NOPING (1UL << 5) 114#define RPC_CLNT_CREATE_NOPING (1UL << 5)
115#define RPC_CLNT_CREATE_DISCRTRY (1UL << 6)
114 116
115struct rpc_clnt *rpc_create(struct rpc_create_args *args); 117struct rpc_clnt *rpc_create(struct rpc_create_args *args);
116struct rpc_clnt *rpc_bind_new_program(struct rpc_clnt *, 118struct rpc_clnt *rpc_bind_new_program(struct rpc_clnt *,
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c
index 393e70aee181..c21aa0a7f770 100644
--- a/net/sunrpc/clnt.c
+++ b/net/sunrpc/clnt.c
@@ -249,6 +249,8 @@ struct rpc_clnt *rpc_create(struct rpc_create_args *args)
249 clnt->cl_autobind = 1; 249 clnt->cl_autobind = 1;
250 if (args->flags & RPC_CLNT_CREATE_ONESHOT) 250 if (args->flags & RPC_CLNT_CREATE_ONESHOT)
251 clnt->cl_oneshot = 1; 251 clnt->cl_oneshot = 1;
252 if (args->flags & RPC_CLNT_CREATE_DISCRTRY)
253 clnt->cl_discrtry = 1;
252 254
253 return clnt; 255 return clnt;
254} 256}
diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c
index cf59f7d315d0..1975139b26e7 100644
--- a/net/sunrpc/xprt.c
+++ b/net/sunrpc/xprt.c
@@ -735,6 +735,16 @@ void xprt_transmit(struct rpc_task *task)
735 xprt_reset_majortimeo(req); 735 xprt_reset_majortimeo(req);
736 /* Turn off autodisconnect */ 736 /* Turn off autodisconnect */
737 del_singleshot_timer_sync(&xprt->timer); 737 del_singleshot_timer_sync(&xprt->timer);
738 } else {
739 /* If all request bytes have been sent,
740 * then we must be retransmitting this one */
741 if (!req->rq_bytes_sent) {
742 if (task->tk_client->cl_discrtry) {
743 xprt_disconnect(xprt);
744 task->tk_status = -ENOTCONN;
745 return;
746 }
747 }
738 } 748 }
739 } else if (!req->rq_bytes_sent) 749 } else if (!req->rq_bytes_sent)
740 return; 750 return;