All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chuck Lever <chuck.lever@oracle.com>
To: trond.myklebust@netapp.com
Cc: linux-nfs@vger.kernel.org
Subject: [PATCH 10/11] SUNRPC: Use soft connect semantics when performing RPC ping
Date: Thu, 05 Nov 2009 13:23:42 -0500	[thread overview]
Message-ID: <20091105182342.2796.77879.stgit@matisse.1015granger.net> (raw)
In-Reply-To: <20091105181924.2796.9313.stgit-RytpoXr2tKZ9HhUboXbp9zCvJB+x5qRC@public.gmane.org>

Currently, if a remote RPC service is unreachable, an RPC ping will
hang until the underlying transport connect attempt times out.  A more
desirable behavior might be to have the ping fail immediately so upper
layers can recover appropriately.

In the case of an NFS mount, for instance, this would mean the
mount(2) system call could fail immediately if the server isn't
listening, rather than hanging uninterruptibly for more than 3
minutes.

Change rpc_ping() so that it fails immediately for connection-oriented
transports.  rpc_create() will then fail immediately for such
transports if an RPC ping was requested.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---

 net/sunrpc/clnt.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c
index 4b76ef9..97931d9 100644
--- a/net/sunrpc/clnt.c
+++ b/net/sunrpc/clnt.c
@@ -79,7 +79,7 @@ static void	call_connect_status(struct rpc_task *task);
 
 static __be32	*rpc_encode_header(struct rpc_task *task);
 static __be32	*rpc_verify_header(struct rpc_task *task);
-static int	rpc_ping(struct rpc_clnt *clnt, int flags);
+static int	rpc_ping(struct rpc_clnt *clnt);
 
 static void rpc_register_client(struct rpc_clnt *clnt)
 {
@@ -340,7 +340,7 @@ struct rpc_clnt *rpc_create(struct rpc_create_args *args)
 		return clnt;
 
 	if (!(args->flags & RPC_CLNT_CREATE_NOPING)) {
-		int err = rpc_ping(clnt, RPC_TASK_SOFT);
+		int err = rpc_ping(clnt);
 		if (err != 0) {
 			rpc_shutdown_client(clnt);
 			return ERR_PTR(err);
@@ -528,7 +528,7 @@ struct rpc_clnt *rpc_bind_new_program(struct rpc_clnt *old,
 	clnt->cl_prog     = program->number;
 	clnt->cl_vers     = version->number;
 	clnt->cl_stats    = program->stats;
-	err = rpc_ping(clnt, RPC_TASK_SOFT);
+	err = rpc_ping(clnt);
 	if (err != 0) {
 		rpc_shutdown_client(clnt);
 		clnt = ERR_PTR(err);
@@ -1709,14 +1709,14 @@ static struct rpc_procinfo rpcproc_null = {
 	.p_decode = rpcproc_decode_null,
 };
 
-static int rpc_ping(struct rpc_clnt *clnt, int flags)
+static int rpc_ping(struct rpc_clnt *clnt)
 {
 	struct rpc_message msg = {
 		.rpc_proc = &rpcproc_null,
 	};
 	int err;
 	msg.rpc_cred = authnull_ops.lookup_cred(NULL, NULL, 0);
-	err = rpc_call_sync(clnt, &msg, flags);
+	err = rpc_call_sync(clnt, &msg, RPC_TASK_SOFT | RPC_TASK_SOFTCONN);
 	put_rpccred(msg.rpc_cred);
 	return err;
 }


  parent reply	other threads:[~2009-11-05 18:23 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-05 18:22 [PATCH 00/11] For 2.6.33 Chuck Lever
     [not found] ` <20091105181924.2796.9313.stgit-RytpoXr2tKZ9HhUboXbp9zCvJB+x5qRC@public.gmane.org>
2009-11-05 18:22   ` [PATCH 01/11] SUNRPC: Display compressed (shorthand) IPv6 presentation addresses Chuck Lever
2009-11-05 18:22   ` [PATCH 02/11] NFS: Display compressed (shorthand) IPv6 in /proc/mounts Chuck Lever
2009-11-05 18:22   ` [PATCH 03/11] NFS: Revert default r/wsize behavior Chuck Lever
2009-11-05 18:22   ` [PATCH 04/11] SUNRPC: Check explicitly for tk_status == 0 in call_transmit_status() Chuck Lever
2009-11-05 18:23   ` [PATCH 05/11] SUNRPC: Allow RPCs to fail quickly if the server is unreachable Chuck Lever
2009-11-05 18:23   ` [PATCH 06/11] SUNRPC: Simplify synopsis of rpcb_local_clnt() Chuck Lever
2009-11-05 18:23   ` [PATCH 07/11] SUNRPC: Use a cached RPC client and transport for rpcbind upcalls Chuck Lever
     [not found]     ` <20091105182319.2796.62305.stgit-RytpoXr2tKZ9HhUboXbp9zCvJB+x5qRC@public.gmane.org>
2009-11-20 20:18       ` Trond Myklebust
2009-11-20 20:19         ` Chuck Lever
2009-11-20 21:50         ` Chuck Lever
2009-11-20 22:05           ` J. Bruce Fields
2009-11-20 22:24             ` Chuck Lever
2009-11-20 22:36               ` J. Bruce Fields
2009-11-20 23:47                 ` Trond Myklebust
2009-11-05 18:23   ` [PATCH 08/11] SUNRPC: Use TCP for local " Chuck Lever
2009-11-05 18:23   ` [PATCH 09/11] SUNRPC: Use soft connects for autobinding over TCP Chuck Lever
2009-11-05 18:23   ` Chuck Lever [this message]
2009-11-05 18:23   ` [PATCH 11/11] SUNRPC: soft connect semantics for UDP Chuck Lever

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20091105182342.2796.77879.stgit@matisse.1015granger.net \
    --to=chuck.lever@oracle.com \
    --cc=linux-nfs@vger.kernel.org \
    --cc=trond.myklebust@netapp.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.