All of lore.kernel.org
 help / color / mirror / Atom feed
From: "J. Bruce Fields" <bfields@redhat.com>
To: linux-nfs@vger.kernel.org
Cc: Trond.Myklebust@netapp.com, chuck.lever@oracle.com,
	simo@redhat.com, "J. Bruce Fields" <bfields@redhat.com>
Subject: [PATCH 1/6] SUNRPC: make AF_LOCAL connect synchronous
Date: Thu, 21 Feb 2013 11:38:20 -0500	[thread overview]
Message-ID: <1361464705-12340-2-git-send-email-bfields@redhat.com> (raw)
In-Reply-To: <1361464705-12340-1-git-send-email-bfields@redhat.com>

From: "J. Bruce Fields" <bfields@redhat.com>

It doesn't appear that anyone actually needs to connect asynchronously.

Also, using a workqueue for the connect means we lose the namespace
information from the original process.  This is a problem since there's
no way to explicitly pass in a filesystem namespace for resolution of an
AF_LOCAL address.

Signed-off-by: J. Bruce Fields <bfields@redhat.com>
---
 net/sunrpc/xprtsock.c |   35 +++++++++++++++++++++++++++--------
 1 file changed, 27 insertions(+), 8 deletions(-)

diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c
index bbc0915..b1df874 100644
--- a/net/sunrpc/xprtsock.c
+++ b/net/sunrpc/xprtsock.c
@@ -1866,13 +1866,9 @@ static int xs_local_finish_connecting(struct rpc_xprt *xprt,
  * @xprt: RPC transport to connect
  * @transport: socket transport to connect
  * @create_sock: function to create a socket of the correct type
- *
- * Invoked by a work queue tasklet.
  */
-static void xs_local_setup_socket(struct work_struct *work)
+static void xs_local_setup_socket(struct sock_xprt *transport)
 {
-	struct sock_xprt *transport =
-		container_of(work, struct sock_xprt, connect_worker.work);
 	struct rpc_xprt *xprt = &transport->xprt;
 	struct socket *sock;
 	int status = -EIO;
@@ -1919,6 +1915,31 @@ out:
 	current->flags &= ~PF_FSTRANS;
 }
 
+static void xs_local_connect(struct rpc_task *task)
+{
+	struct rpc_xprt *xprt = task->tk_xprt;
+	struct sock_xprt *transport = container_of(xprt, struct sock_xprt, xprt);
+	unsigned long timeout;
+
+	 if (RPC_IS_ASYNC(task))
+	 	rpc_exit(task, -ENOTCONN);
+
+	if (transport->sock != NULL && !RPC_IS_SOFTCONN(task)) {
+		dprintk("RPC:       xs_connect delayed xprt %p for %lu "
+				"seconds\n",
+				xprt, xprt->reestablish_timeout / HZ);
+		timeout = xprt->reestablish_timeout;
+		xprt->reestablish_timeout <<= 1;
+		if (xprt->reestablish_timeout < XS_TCP_INIT_REEST_TO)
+			xprt->reestablish_timeout = XS_TCP_INIT_REEST_TO;
+		if (xprt->reestablish_timeout > XS_TCP_MAX_REEST_TO)
+			xprt->reestablish_timeout = XS_TCP_MAX_REEST_TO;
+		rpc_delay(task, timeout);
+	} else
+		dprintk("RPC:       xs_connect scheduled xprt %p\n", xprt);
+	xs_local_setup_socket(transport);
+}
+
 #ifdef CONFIG_SUNRPC_SWAP
 static void xs_set_memalloc(struct rpc_xprt *xprt)
 {
@@ -2454,7 +2475,7 @@ static struct rpc_xprt_ops xs_local_ops = {
 	.alloc_slot		= xprt_alloc_slot,
 	.rpcbind		= xs_local_rpcbind,
 	.set_port		= xs_local_set_port,
-	.connect		= xs_connect,
+	.connect		= xs_local_connect,
 	.buf_alloc		= rpc_malloc,
 	.buf_free		= rpc_free,
 	.send_request		= xs_local_send_request,
@@ -2627,8 +2648,6 @@ static struct rpc_xprt *xs_setup_local(struct xprt_create *args)
 			goto out_err;
 		}
 		xprt_set_bound(xprt);
-		INIT_DELAYED_WORK(&transport->connect_worker,
-					xs_local_setup_socket);
 		xs_format_peer_addresses(xprt, "local", RPCBIND_NETID_LOCAL);
 		break;
 	default:
-- 
1.7.9.5


  reply	other threads:[~2013-02-21 16:38 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-21 16:38 [PATCH 0/6] gss-proxy upcall for nfsd J. Bruce Fields
2013-02-21 16:38 ` J. Bruce Fields [this message]
2013-02-21 18:17   ` [PATCH 1/6] SUNRPC: make AF_LOCAL connect synchronous Myklebust, Trond
2013-02-21 19:48     ` J. Bruce Fields
2013-02-21 20:02       ` Myklebust, Trond
2013-02-21 20:36         ` J. Bruce Fields
2013-02-21 20:42           ` Myklebust, Trond
2013-02-26  4:06             ` [PATCH] " J. Bruce Fields
2013-02-21 16:38 ` [PATCH 2/6] SUNRPC: attempt AF_LOCAL connect on setup J. Bruce Fields
2013-02-21 16:38 ` [PATCH 3/6] SUNRPC: no idle timeout for AF_LOCAL sockets J. Bruce Fields
2013-02-21 16:38 ` [PATCH 4/6] SUNRPC: conditionally return endtime from import_sec_context J. Bruce Fields
2013-02-21 16:38 ` [PATCH 5/6] SUNRPC: Add RPC based upcall mechanism for RPCGSS auth J. Bruce Fields
2013-02-21 18:35   ` Myklebust, Trond
2013-02-21 19:58     ` J. Bruce Fields
2013-02-21 21:37     ` J. Bruce Fields
2013-04-12 18:11     ` J. Bruce Fields
2013-04-12 18:21       ` Myklebust, Trond
2013-04-12 18:33         ` J. Bruce Fields
2013-02-21 16:38 ` [PATCH 6/6] SUNRPC: Use gssproxy upcall for server RPCGSS authentication J. Bruce Fields
2013-02-21 21:01   ` J. Bruce Fields
2013-02-26 13:27     ` Simo Sorce

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=1361464705-12340-2-git-send-email-bfields@redhat.com \
    --to=bfields@redhat.com \
    --cc=Trond.Myklebust@netapp.com \
    --cc=chuck.lever@oracle.com \
    --cc=linux-nfs@vger.kernel.org \
    --cc=simo@redhat.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.