From: Stanislav Kinsbursky <skinsbursky@parallels.com>
To: "J. Bruce Fields" <bfields@fieldses.org>
Cc: "Trond.Myklebust@netapp.com" <Trond.Myklebust@netapp.com>,
Christoph Hellwig <hch@infradead.org>,
"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>,
"Eric W. Biederman" <ebiederm@xmission.com>
Subject: Re: [PATCH v3] SUNRPC: set desired file system root before connecting local transports
Date: Thu, 15 Nov 2012 12:35:09 +0400 [thread overview]
Message-ID: <50A4A93D.5010001@parallels.com> (raw)
In-Reply-To: <20121114210112.GA539@fieldses.org>
15.11.2012 01:01, J. Bruce Fields пишет:
> On Mon, Nov 12, 2012 at 12:37:54PM +0400, Stanislav Kinsbursky wrote:
>> 07.11.2012 22:33, J. Bruce Fields пишет:
>>> On Tue, Nov 06, 2012 at 08:36:05AM -0500, J. Bruce Fields wrote:
>>>> On Tue, Nov 06, 2012 at 08:10:18AM -0500, Christoph Hellwig wrote:
>>>>> On Tue, Nov 06, 2012 at 08:07:06AM -0500, J. Bruce Fields wrote:
>>>>>> So you're worried that a bug in the nfs code could modify the root and
>>>>>> then not restore it?
>>>>>
>>>>> At least the link you pointed to earlier never sets it back.
>>>>
>>>> This? http://thread.gmane.org/gmane.linux.kernel/1259986/focus=47687
>>>>
>>>> + get_fs_root(current->fs, &root);
>>>> + set_fs_root(current->fs, &transport->root);
>>>> +
>>>> status = xs_local_finish_connecting(xprt, sock);
>>>> +
>>>> + set_fs_root(current->fs, &root);
>>>> + path_put(&root);
>>>>
>>>>> Instead
>>>>> of messing with it I'd rather have the sunrpc code use vfs_path_lookup
>>>>> and not care about current->fs->root at all.
>>>>
>>>> The annoyance is that the lookup happens somewhere lower down in the
>>>> networking code (net/unix/af_unix.c:unix_find_other, I think). So we'd
>>>> need some new (internal) API. We'd likely be the only user of that new
>>>> API.
>>>
>>> So, if the only drawback is really just the risk of introducing a bug
>>> that leaves the fs_root changed--the above seems simple enough for that
>>> not to be a great risk, right?
>>>
>>
>> If we unshare rpciod fs struct (which is exported already), then we
>
> I'm not sure what you mean by that. Do workqueues actually have their
> own dedicated set of associated tasks? I thought all workqueues shared
> a common pool of tasks these days.
>
Any kernel thread is cloned in kthreadd context with CLONE_FS flag.
I.e. all of them shares same fs struct, and changing fs->root in one of kthreads
will affect all others.
That's why either fs struct have to be unshared to swap fs->root or fs->cwd, or
the whole fs struct have to swapped.
--
Best regards,
Stanislav Kinsbursky
prev parent reply other threads:[~2012-11-15 8:35 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-08 10:56 [PATCH v3] SUNRPC: set desired file system root before connecting local transports Stanislav Kinsbursky
2012-10-09 19:35 ` J. Bruce Fields
2012-10-09 19:49 ` Myklebust, Trond
2012-10-09 20:20 ` Eric W. Biederman
2012-10-09 22:31 ` J. Bruce Fields
2012-10-09 22:47 ` Eric W. Biederman
2012-10-10 1:23 ` J. Bruce Fields
2012-10-10 10:32 ` Stanislav Kinsbursky
2012-10-26 17:52 ` J. Bruce Fields
2012-10-10 2:00 ` Eric W. Biederman
2012-10-10 5:09 ` Stanislav Kinsbursky
2012-10-10 5:03 ` Stanislav Kinsbursky
2012-11-06 10:14 ` Stanislav Kinsbursky
2012-11-06 12:06 ` J. Bruce Fields
2012-11-06 12:11 ` Stanislav Kinsbursky
2012-11-06 13:05 ` J. Bruce Fields
2012-11-06 12:40 ` Christoph Hellwig
2012-11-06 13:07 ` J. Bruce Fields
2012-11-06 13:10 ` Christoph Hellwig
2012-11-06 13:36 ` J. Bruce Fields
2012-11-07 18:33 ` J. Bruce Fields
2012-11-12 8:37 ` Stanislav Kinsbursky
2012-11-14 21:01 ` J. Bruce Fields
2012-11-14 21:36 ` Myklebust, Trond
2012-11-14 21:42 ` J. Bruce Fields
2012-11-14 21:51 ` Myklebust, Trond
2012-11-14 21:54 ` J. Bruce Fields
2012-11-15 6:14 ` Eric W. Biederman
2012-11-15 13:34 ` Myklebust, Trond
2012-11-15 18:58 ` J. Bruce Fields
2012-11-15 8:35 ` 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=50A4A93D.5010001@parallels.com \
--to=skinsbursky@parallels.com \
--cc=Trond.Myklebust@netapp.com \
--cc=bfields@fieldses.org \
--cc=devel@openvz.org \
--cc=ebiederm@xmission.com \
--cc=hch@infradead.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).