From: Stanislav Kinsbursky <skinsbursky@parallels•com>
To: Trond.Myklebust@netapp•com
Cc: linux-nfs@vger•kernel.org, xemul@parallels•com, neilb@suse•de,
netdev@vger•kernel.org, linux-kernel@vger•kernel.org,
jbottomley@parallels•com, bfields@fieldses•org,
davem@davemloft•net, devel@openvz•org
Subject: [RFC PATCH] SUNRPC: connect local transports synchronously
Date: Thu, 16 Feb 2012 19:06:25 +0400 [thread overview]
Message-ID: <20120216150507.19081.28659.stgit@localhost6.localdomain6> (raw)
Local tranports uses UNIX sockets and connecting of these sockets is done in
context of file system namespace (i.e. task file system root).
Currenly, all sockets connect operations are performed by rpciod work queue,
which actually means, that any service will be registered in the same rpcbind
instance regardless to process file system root.
This is not containers, which usually have it's own nested root. There are 2
approaches, how to solve the problem. First one is to store proper root in
tranport and switch to it in rpciod workqueue function for connect operations.
But this looks ugly. The second one is to connect to unix sockets
synchronously. This aptch implements the last one.
Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels•com>
---
net/sunrpc/xprtsock.c | 22 +++++++++++++++++++++-
1 files changed, 21 insertions(+), 1 deletions(-)
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c
index 55472c4..365cd6d 100644
--- a/net/sunrpc/xprtsock.c
+++ b/net/sunrpc/xprtsock.c
@@ -2177,6 +2177,26 @@ out:
}
/**
+ * xs_local_connect - connect a local (unix) socket to a remote endpoint
+ * @task: address of RPC task that manages state of connect request
+ *
+ * We have to connect unix sockets synchronously. Otherwise this connection
+ * will be done in file system context of rpciod queue, which is not suitable
+ * for processes with other root (changed root is a usual part of environment
+ * for containers).
+ */
+
+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);
+ struct work_struct *work = &transport->connect_worker.work;
+
+ dprintk("RPC: xs_local_connect xprt %p\n", xprt);
+ work->func(work);
+}
+
+/**
* xs_connect - connect a socket to a remote endpoint
* @task: address of RPC task that manages state of connect request
*
@@ -2414,7 +2434,7 @@ static struct rpc_xprt_ops xs_local_ops = {
.release_xprt = xs_tcp_release_xprt,
.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,
next reply other threads:[~2012-02-16 15:06 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-16 15:06 Stanislav Kinsbursky [this message]
[not found] ` <20120216150507.19081.28659.stgit-bi+AKbBUZKagILUCTcTcHdKyNwTtLsGr@public.gmane.org>
2012-02-16 15:13 ` [RFC PATCH] SUNRPC: connect local transports synchronously Myklebust, Trond
2012-02-17 8:25 ` Stanislav Kinsbursky
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=20120216150507.19081.28659.stgit@localhost6.localdomain6 \
--to=skinsbursky@parallels$(echo .)com \
--cc=Trond.Myklebust@netapp$(echo .)com \
--cc=bfields@fieldses$(echo .)org \
--cc=davem@davemloft$(echo .)net \
--cc=devel@openvz$(echo .)org \
--cc=jbottomley@parallels$(echo .)com \
--cc=linux-kernel@vger$(echo .)kernel.org \
--cc=linux-nfs@vger$(echo .)kernel.org \
--cc=neilb@suse$(echo .)de \
--cc=netdev@vger$(echo .)kernel.org \
--cc=xemul@parallels$(echo .)com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox