All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stanislav Kinsbursky <skinsbursky@parallels.com>
To: "Myklebust, Trond" <Trond.Myklebust@netapp.com>
Cc: "linux-nfs@vger.kernel.org" <linux-nfs@vger.kernel.org>,
	"devel@openvz.org" <devel@openvz.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"jlayton@redhat.com" <jlayton@redhat.com>
Subject: Re: [PATCH v3 2/4] SUNRPC: fix races on PipeFS UMOUNT notifications
Date: Wed, 26 Jun 2013 09:32:09 +0400	[thread overview]
Message-ID: <51CA7CD9.1050209@parallels.com> (raw)
In-Reply-To: <1372176778.5968.29.camel@leira.trondhjem.org>

25.06.2013 20:13, Myklebust, Trond пишет:
> On Mon, 2013-06-24 at 11:52 +0400, Stanislav Kinsbursky wrote:
>> CPU#0                                   CPU#1
>> -----------------------------           -----------------------------
>> rpc_kill_sb
>> sn->pipefs_sb = NULL                    rpc_release_client
>> (UMOUNT_EVENT)                          rpc_free_auth
>> rpc_pipefs_event
>> rpc_get_client_for_event
>> !atomic_inc_not_zero(cl_count)
>> <skip the client>
>>                                          atomic_inc(cl_count)
>>                                          rpc_free_client
>>                                          rpc_clnt_remove_pipedir
>>                                          <skip client dir removing>
>>
>> To fix this, this patch does the following:
>>
>> 1) Calls RPC_PIPEFS_UMOUNT notification with sn->pipefs_sb_lock being held.
>> 2) Removes SUNRPC client from the list AFTER pipes destroying.
>> 3) Doesn't hold RPC client on notification: if client in the list, then it
>> can't be destroyed while sn->pipefs_sb_lock in hold by notification caller.
>>
>> Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
>> Cc: stable@vger.kernel.org
>> ---
>>   net/sunrpc/clnt.c     |    5 +----
>>   net/sunrpc/rpc_pipe.c |    2 +-
>>   2 files changed, 2 insertions(+), 5 deletions(-)
>
> <snip>
>
>> diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c
>> index c512448..efca2f7 100644
>> --- a/net/sunrpc/rpc_pipe.c
>> +++ b/net/sunrpc/rpc_pipe.c
>> @@ -1165,7 +1165,6 @@ static void rpc_kill_sb(struct super_block *sb)
>>   		goto out;
>>   	}
>>   	sn->pipefs_sb = NULL;
>> -	mutex_unlock(&sn->pipefs_sb_lock);
>>   	dprintk("RPC:       sending pipefs UMOUNT notification for net %p%s\n",
>>   		net, NET_NAME(net));
>>   	blocking_notifier_call_chain(&rpc_pipefs_notifier_list,
>> @@ -1173,6 +1172,7 @@ static void rpc_kill_sb(struct super_block *sb)
>>   					   sb);
>>   	put_net(net);
>>   out:
>> +	mutex_unlock(&sn->pipefs_sb_lock);
>
> Is this safe to do after the put_net()?
>

Sure it's not. Sorry.
Will send the patch once more.

>>   	kill_litter_super(sb);
>>   }
>>
>>
>
>


-- 
Best regards,
Stanislav Kinsbursky

  reply	other threads:[~2013-06-26  5:32 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-24  7:52 [PATCH v3 0/4] SUNRPC: PipeFS races fixes Stanislav Kinsbursky
2013-06-24  7:52 ` [PATCH v3 1/4] SUNRPC: fix races on PipeFS MOUNT notifications Stanislav Kinsbursky
2013-06-24  7:52 ` [PATCH v3 2/4] SUNRPC: fix races on PipeFS UMOUNT notifications Stanislav Kinsbursky
2013-06-25 16:13   ` Myklebust, Trond
2013-06-26  5:32     ` Stanislav Kinsbursky [this message]
2013-06-26  6:15   ` [PATCH v4] " Stanislav Kinsbursky
2013-06-28 11:51     ` William Dauchy
2013-06-24  7:52 ` [PATCH v3 3/4] SUNRPC: split client creation routine into setup and registration Stanislav Kinsbursky
2013-06-24  7:52 ` [PATCH v3 4/4] SUNRPC: PipeFS MOUNT notification optimization for dying clients 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=51CA7CD9.1050209@parallels.com \
    --to=skinsbursky@parallels.com \
    --cc=Trond.Myklebust@netapp.com \
    --cc=devel@openvz.org \
    --cc=jlayton@redhat.com \
    --cc=linux-kernel@vger.kernel.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.