From: Chuck Lever <chuck.lever@oracle.com>
To: Trond Myklebust <Trond.Myklebust@netapp.com>
Cc: nfsv4@linux-nfs.org, Tom Talpey <Thomas.Talpey@netapp.com>,
nfs@lists.sourceforge.net
Subject: Re: [PATCH 1/7] SUNRPC: Fix a race in xs_tcp_state_change()
Date: Wed, 07 Nov 2007 17:21:22 -0500 [thread overview]
Message-ID: <47323A62.9000803@oracle.com> (raw)
In-Reply-To: <20071107003940.13713.65472.stgit@heimdal.trondhjem.org>
[-- Attachment #1: Type: text/plain, Size: 3148 bytes --]
Trond Myklebust wrote:
> From: Trond Myklebust <Trond.Myklebust@netapp.com>
>
> When scheduling the autoclose RPC call, we want to ensure that we don't
> race against the test_bit() call in xprt_clear_locked().
>
> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
> ---
>
> include/linux/sunrpc/xprt.h | 1 +
> net/sunrpc/xprt.c | 20 ++++++++++++++++++++
> net/sunrpc/xprtsock.c | 5 +----
> 3 files changed, 22 insertions(+), 4 deletions(-)
>
> diff --git a/include/linux/sunrpc/xprt.h b/include/linux/sunrpc/xprt.h
> index 30b17b3..6f524a9 100644
> --- a/include/linux/sunrpc/xprt.h
> +++ b/include/linux/sunrpc/xprt.h
> @@ -246,6 +246,7 @@ struct rpc_rqst * xprt_lookup_rqst(struct rpc_xprt *xprt, __be32 xid);
> void xprt_complete_rqst(struct rpc_task *task, int copied);
> void xprt_release_rqst_cong(struct rpc_task *task);
> void xprt_disconnect(struct rpc_xprt *xprt);
> +void xprt_force_disconnect(struct rpc_xprt *xprt);
>
> /*
> * Reserved bit positions in xprt->state
> diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c
> index 282a9a2..48c5a8b 100644
> --- a/net/sunrpc/xprt.c
> +++ b/net/sunrpc/xprt.c
> @@ -570,6 +570,7 @@ static void xprt_autoclose(struct work_struct *work)
>
> xprt_disconnect(xprt);
> xprt->ops->close(xprt);
> + clear_bit(XPRT_CLOSE_WAIT, &xprt->state);
xs_close already clears the CLOSE_WAIT bit, and so does xs_tcp_shutdown
(added in a later patch). So this hunk appears to be unnecessary.
But xprt_rdma_close doesn't clear CLOSE_WAIT, it appears. Do we want to
copy (some of) the logic from the end of xs_close into xprt_rdma_close?
> xprt_release_write(xprt, NULL);
> }
>
> @@ -588,6 +589,25 @@ void xprt_disconnect(struct rpc_xprt *xprt)
> }
> EXPORT_SYMBOL_GPL(xprt_disconnect);
>
> +/**
> + * xprt_force_disconnect - force a transport to disconnect
> + * @xprt: transport to disconnect
> + *
> + */
> +void xprt_force_disconnect(struct rpc_xprt *xprt)
> +{
> + /* Don't race with the test_bit() in xprt_clear_locked() */
> + spin_lock_bh(&xprt->transport_lock);
> + set_bit(XPRT_CLOSE_WAIT, &xprt->state);
> + /* Try to schedule an autoclose RPC call */
> + if (test_and_set_bit(XPRT_LOCKED, &xprt->state) == 0)
> + queue_work(rpciod_workqueue, &xprt->task_cleanup);
> + else if (xprt->snd_task != NULL)
> + rpc_wake_up_task(xprt->snd_task);
What's this new bit of logic for?
> + spin_unlock_bh(&xprt->transport_lock);
> +}
> +EXPORT_SYMBOL_GPL(xprt_force_disconnect);
> +
> static void
> xprt_init_autodisconnect(unsigned long data)
> {
> diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c
> index 02298f5..322e4e2 100644
> --- a/net/sunrpc/xprtsock.c
> +++ b/net/sunrpc/xprtsock.c
> @@ -1118,10 +1118,7 @@ static void xs_tcp_state_change(struct sock *sk)
> case TCP_SYN_RECV:
> break;
> case TCP_CLOSE_WAIT:
> - /* Try to schedule an autoclose RPC calls */
> - set_bit(XPRT_CLOSE_WAIT, &xprt->state);
> - if (test_and_set_bit(XPRT_LOCKED, &xprt->state) == 0)
> - queue_work(rpciod_workqueue, &xprt->task_cleanup);
> + xprt_force_disconnect(xprt);
> default:
> xprt_disconnect(xprt);
> }
[-- Attachment #2: chuck.lever.vcf --]
[-- Type: text/x-vcard, Size: 259 bytes --]
begin:vcard
fn:Chuck Lever
n:Lever;Chuck
org:Oracle Corporation;Corporate Architecture: Linux Projects Group
adr:;;1015 Granger Avenue;Ann Arbor;MI;48104;USA
title:Principal Member of Staff
tel;work:+1 248 614 5091
x-mozilla-html:FALSE
version:2.1
end:vcard
[-- Attachment #3: Type: text/plain, Size: 314 bytes --]
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
[-- Attachment #4: Type: text/plain, Size: 140 bytes --]
_______________________________________________
NFS maillist - NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs
next prev parent reply other threads:[~2007-11-07 22:21 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-11-07 0:39 [PATCH 0/7] Improve the NFS/TCP reconnection code Trond Myklebust
2007-11-07 0:39 ` [PATCH 1/7] SUNRPC: Fix a race in xs_tcp_state_change() Trond Myklebust
2007-11-07 22:21 ` Chuck Lever [this message]
2007-11-07 22:32 ` [NFS] " Trond Myklebust
2007-11-07 23:47 ` setclientid: string in use on NFS v4 share on Debian Etch & hosts file "solution" Matt Weatherford
2007-11-09 19:55 ` J. Bruce Fields
2007-11-08 15:40 ` [NFS] [PATCH 1/7] SUNRPC: Fix a race in xs_tcp_state_change() Chuck Lever
2007-11-08 16:12 ` Trond Myklebust
2007-11-07 0:39 ` [PATCH 2/7] SUNRPC: Fix TCP rebinding logic Trond Myklebust
2007-11-07 22:48 ` Chuck Lever
2007-11-07 23:08 ` Trond Myklebust
2007-11-07 23:28 ` [NFS] " Chuck Lever
2007-11-07 23:47 ` Trond Myklebust
2007-11-09 13:35 ` Talpey, Thomas
2007-11-07 0:39 ` [PATCH 3/7] SUNRPC: Allow the client to detect if the TCP connection is closed Trond Myklebust
2007-11-09 14:04 ` Talpey, Thomas
2007-11-09 14:33 ` [NFS] " Trond Myklebust
2007-11-09 14:35 ` Talpey, Thomas
2007-11-09 14:48 ` Trond Myklebust
2007-11-09 15:25 ` Talpey, Thomas
2007-11-09 15:32 ` [NFS] " Trond Myklebust
2007-11-09 16:53 ` Talpey, Thomas
2007-11-09 17:37 ` Trond Myklebust
2007-11-09 17:52 ` [NFS] " Talpey, Thomas
2007-11-09 18:21 ` Trond Myklebust
2007-11-07 0:39 ` [PATCH 4/7] SUNRPC: Use shutdown() instead of close() when disconnecting a TCP socket Trond Myklebust
2007-11-07 23:11 ` [NFS] " Chuck Lever
2007-11-07 23:59 ` Trond Myklebust
2007-11-09 13:38 ` Talpey, Thomas
2007-11-09 13:51 ` [NFS] " Trond Myklebust
2007-11-07 0:40 ` [PATCH 5/7] SUNRPC: xprt_autoclose() should not call xprt_disconnect() Trond Myklebust
2007-11-09 13:56 ` [NFS] " Talpey, Thomas
2007-11-07 0:40 ` [PATCH 6/7] SUNRPC: Make call_status()/call_decode() call xprt_force_disconnect() Trond Myklebust
2007-11-07 23:15 ` [NFS] " Chuck Lever
2007-11-07 0:40 ` [PATCH 7/7] SUNRPC: Rename xprt_disconnect() Trond Myklebust
2007-11-07 23:16 ` [NFS] " Chuck Lever
2007-11-08 0:01 ` 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=47323A62.9000803@oracle.com \
--to=chuck.lever@oracle.com \
--cc=Thomas.Talpey@netapp.com \
--cc=Trond.Myklebust@netapp.com \
--cc=nfs@lists.sourceforge.net \
--cc=nfsv4@linux-nfs.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 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.