All of lore.kernel.org
 help / color / mirror / Atom feed
From: Trond Myklebust <trondmy@primarydata.com>
To: Fields Bruce <bfields@fieldses.org>
Cc: "linux-nfs@vger.kernel.org" <linux-nfs@vger.kernel.org>
Subject: Re: [PATCH 05/10] SUNRPC: lock the socket while detaching it
Date: Fri, 24 Jun 2016 21:21:34 +0000	[thread overview]
Message-ID: <470C748D-4E15-4F31-88B8-A78A446FDB1A@primarydata.com> (raw)
In-Reply-To: <20160624210632.GJ3287@fieldses.org>


> On Jun 24, 2016, at 17:06, J. Bruce Fields <bfields@fieldses.org> wrote:
> 
> On Fri, Jun 24, 2016 at 10:55:47AM -0400, Trond Myklebust wrote:
>> Prevent callbacks from triggering while we're detaching the socket.
> 
> What motivated this?  Do we have a bug without it?

Code inspection. Without locking, what ensures that you don’t have another processor calling into, say, svc_tcp_state_change() while this processor is tearing down your svc_sock.

> 
> --b.
> 
>> 
>> Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
>> ---
>> net/sunrpc/svcsock.c | 3 +++
>> 1 file changed, 3 insertions(+)
>> 
>> diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c
>> index dadfec66dbd8..abe2da602fb8 100644
>> --- a/net/sunrpc/svcsock.c
>> +++ b/net/sunrpc/svcsock.c
>> @@ -1611,9 +1611,12 @@ static void svc_sock_detach(struct svc_xprt *xprt)
>> 	dprintk("svc: svc_sock_detach(%p)\n", svsk);
>> 
>> 	/* put back the old socket callbacks */
>> +	lock_sock(sk);
>> 	sk->sk_state_change = svsk->sk_ostate;
>> 	sk->sk_data_ready = svsk->sk_odata;
>> 	sk->sk_write_space = svsk->sk_owspace;
>> +	sk->sk_user_data = NULL;
>> +	release_sock(sk);
>> 
>> 	wq = sk_sleep(sk);
>> 	if (sunrpc_waitqueue_active(wq))
>> -- 
>> 2.7.4
> 


  reply	other threads:[~2016-06-24 21:21 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-24 14:55 [PATCH 01/10] SUNRPC: Fix tracepoint storage issues with svc_recv and svc_rqst_status Trond Myklebust
2016-06-24 14:55 ` [PATCH 02/10] SUNRPC: Don't allocate a full sockaddr_storage for tracing Trond Myklebust
2016-06-24 14:55   ` [PATCH 03/10] SUNRPC: Add a tracepoint for server socket out-of-space conditions Trond Myklebust
2016-06-24 14:55     ` [PATCH 04/10] SUNRPC: Add tracepoints for dropped and deferred requests Trond Myklebust
2016-06-24 14:55       ` [PATCH 05/10] SUNRPC: lock the socket while detaching it Trond Myklebust
2016-06-24 14:55         ` [PATCH 06/10] SUNRPC: Call the default socket callbacks instead of open coding Trond Myklebust
2016-06-24 14:55           ` [PATCH 07/10] SUNRPC: Micro optimisation for svc_data_ready Trond Myklebust
2016-06-24 14:55             ` [PATCH 08/10] SUNRPC: Add a server side per-connection limit Trond Myklebust
2016-06-24 14:55               ` [PATCH 09/10] SUNRPC: Change TCP socket space reservation Trond Myklebust
2016-06-24 14:55                 ` [PATCH 10/10] SUNRPC: Remove unused callback xpo_adjust_wspace() Trond Myklebust
2016-06-24 21:18                 ` [PATCH 09/10] SUNRPC: Change TCP socket space reservation J. Bruce Fields
2016-06-24 21:31                   ` Trond Myklebust
2016-07-06 20:17                     ` Fields Bruce
2016-07-06 19:53                 ` J. Bruce Fields
2016-07-06 20:11                   ` Trond Myklebust
2016-07-06 20:30                     ` Fields Bruce
2016-06-24 21:15               ` [PATCH 08/10] SUNRPC: Add a server side per-connection limit J. Bruce Fields
2016-06-24 21:24                 ` Trond Myklebust
2016-07-06 16:16               ` J. Bruce Fields
2016-06-24 21:06         ` [PATCH 05/10] SUNRPC: lock the socket while detaching it J. Bruce Fields
2016-06-24 21:21           ` Trond Myklebust [this message]
2016-06-24 18:28 ` [PATCH 01/10] SUNRPC: Fix tracepoint storage issues with svc_recv and svc_rqst_status J. Bruce Fields

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=470C748D-4E15-4F31-88B8-A78A446FDB1A@primarydata.com \
    --to=trondmy@primarydata.com \
    --cc=bfields@fieldses.org \
    --cc=linux-nfs@vger.kernel.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.