From: Stanislav Kinsbursky <skinsbursky@parallels.com>
To: "Myklebust, Trond" <Trond.Myklebust@netapp.com>
Cc: "linux-nfs@vger.kernel.org" <linux-nfs@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"devel@openvz.org" <devel@openvz.org>
Subject: Re: [PATCH] NFS: init client before declaration
Date: Tue, 22 May 2012 19:03:37 +0400 [thread overview]
Message-ID: <4FBBAAC9.2090403@parallels.com> (raw)
In-Reply-To: <1337696984.4269.4.camel@lade.trondhjem.org>
On 22.05.2012 18:29, Myklebust, Trond wrote:
> On Tue, 2012-05-22 at 16:40 +0400, Stanislav Kinsbursky wrote:
>> Client have to be initialized prior to adding it to per-net clients list,
>> because otherwise there are races, shown below:
>>
>> CPU#0 CPU#1
>> _____ _____
>>
>> nfs_get_client
>> nfs_alloc_client
>> list_add(..., nfs_client_list)
>> rpc_fill_super
>> rpc_pipefs_event
>> nfs_get_client_for_event
>> __rpc_pipefs_event
>> (clp->cl_rpcclient is uninitialized)
>> BUG()
>> init_client
>> clp->cl_rpcclient = ...
>>
>
> Why not simply change nfs_get_client_for_event() so that it doesn't
> touch nfs_clients that have clp->cl_cons_state!=NFS_CS_READY?
>
> That should ensure that it doesn't touch nfs_clients that failed to
> initialise and/or are still in the process of being initialised.
>
It looks like in this case we will have another races:
CPU#0 CPU#1
_____ _____
nfs4_init_client
nfs_idmap_new
nfs_idmap_register
rpc_get_sb_net (fail - no pipefs)
rpc_fill_super
rpc_pipefs_event
nfs_get_client_for_event
(skip client - NFS_CS_READY is not set)
nfs_mark_client_ready(NFS_CS_READY)
And we are having client without idmap pipe...
> Cheers
> Trond
>
--
Best regards,
Stanislav Kinsbursky
prev parent reply other threads:[~2012-05-22 15:03 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-22 12:40 [PATCH] NFS: init client before declaration Stanislav Kinsbursky
2012-05-22 13:47 ` Chuck Lever
2012-05-22 14:29 ` Myklebust, Trond
2012-05-22 15:00 ` Myklebust, Trond
2012-05-22 15:29 ` Stanislav Kinsbursky
2012-05-22 15:51 ` Myklebust, Trond
2012-05-22 16:18 ` Stanislav Kinsbursky
2012-05-22 16:43 ` Myklebust, Trond
2012-05-22 20:32 ` Myklebust, Trond
2012-05-23 11:30 ` Stanislav Kinsbursky
2012-05-23 12:09 ` Kinsbursky Stanislav
2012-05-23 13:57 ` Myklebust, Trond
2012-05-22 15:03 ` Stanislav Kinsbursky [this message]
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=4FBBAAC9.2090403@parallels.com \
--to=skinsbursky@parallels.com \
--cc=Trond.Myklebust@netapp.com \
--cc=devel@openvz.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).