From: Trond Myklebust <Trond.Myklebust@netapp.com>
To: Linus Torvalds <torvalds@osdl.org>
Cc: linux-kernel@vger.kernel.org, nfs@lists.sourceforge.net
Subject: [PATCH 10/11] SUNRPC: fix race in in-kernel RPC portmapper client
Date: Thu, 19 Oct 2006 13:04:32 -0400 [thread overview]
Message-ID: <20061019170432.8171.96764.stgit@lade.trondhjem.org> (raw)
In-Reply-To: <20061019170432.8171.75076.stgit@lade.trondhjem.org>
From: Chuck Lever <chuck.lever@oracle.com>
When submitting a request to a fast portmapper (such as the local rpcbind
daemon), the request can complete before the parent task is even queued up
on xprt->binding. Fix this by queuing before submitting the rpcbind
request.
Test plan:
Connectathon locking test with UDP.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
---
net/sunrpc/pmap_clnt.c | 14 +++++++-------
1 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/net/sunrpc/pmap_clnt.c b/net/sunrpc/pmap_clnt.c
index 919d5ba..e52afab 100644
--- a/net/sunrpc/pmap_clnt.c
+++ b/net/sunrpc/pmap_clnt.c
@@ -101,11 +101,13 @@ void rpc_getport(struct rpc_task *task)
/* Autobind on cloned rpc clients is discouraged */
BUG_ON(clnt->cl_parent != clnt);
- if (xprt_test_and_set_binding(xprt)) {
- task->tk_status = -EACCES; /* tell caller to check again */
- rpc_sleep_on(&xprt->binding, task, NULL, NULL);
- return;
- }
+ /* Put self on queue before sending rpcbind request, in case
+ * pmap_getport_done completes before we return from rpc_run_task */
+ rpc_sleep_on(&xprt->binding, task, NULL, NULL);
+
+ status = -EACCES; /* tell caller to check again */
+ if (xprt_test_and_set_binding(xprt))
+ goto bailout_nofree;
/* Someone else may have bound if we slept */
status = 0;
@@ -134,8 +136,6 @@ void rpc_getport(struct rpc_task *task)
goto bailout;
rpc_release_task(child);
- rpc_sleep_on(&xprt->binding, task, NULL, NULL);
-
task->tk_xprt->stat.bind_count++;
return;
next prev parent reply other threads:[~2006-10-19 17:08 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-10-19 17:04 [PATCH 01/11] NFSv4: Fix thinko in fs/nfs/super.c Trond Myklebust
2006-10-19 17:04 ` [PATCH 07/11] NFS: fix minor bug in new NFS symlink code Trond Myklebust
2006-10-20 4:25 ` Andrew Morton
2006-10-20 4:57 ` [NFS] " Chuck Lever
2006-10-19 17:04 ` [PATCH 04/11] nfs4: initialize cl_ipaddr Trond Myklebust
2006-10-19 17:04 ` [PATCH 08/11] NFS: __nfs_revalidate_inode() can use "inode" before checking it is non-NULL Trond Myklebust
2006-10-19 17:04 ` [PATCH 09/11] NFS: remove unused check in nfs4_open_revalidate Trond Myklebust
2006-10-19 17:04 ` Trond Myklebust [this message]
2006-10-19 17:04 ` [PATCH 06/11] NFS: Deal with failure of invalidate_inode_pages2() Trond Myklebust
2006-10-19 17:04 ` [PATCH 03/11] NFS: Fix error handling in nfs_direct_write_result() Trond Myklebust
2006-10-19 17:04 ` [PATCH 02/11] NFS: Fix oops in nfs_cancel_commit_list Trond Myklebust
2006-10-19 17:04 ` [PATCH 11/11] SUNRPC: fix a typo Trond Myklebust
2006-10-19 17:04 ` [PATCH 05/11] NFS: Fix NFSv4 callback regression Trond Myklebust
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=20061019170432.8171.96764.stgit@lade.trondhjem.org \
--to=trond.myklebust@netapp.com \
--cc=linux-kernel@vger.kernel.org \
--cc=nfs@lists.sourceforge.net \
--cc=torvalds@osdl.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®