From: Jeff Layton <jlayton@redhat.com>
To: Vasily Averin <vvs@virtuozzo.com>,
"J. Bruce Fields" <bfields@fieldses.org>,
linux-nfs@vger.kernel.org
Cc: Stanislav Kinsburskiy <skinsbursky@virtuozzo.com>
Subject: Re: init_net in restart_grace()
Date: Mon, 30 Oct 2017 13:20:07 -0400 [thread overview]
Message-ID: <1509384007.5412.43.camel@redhat.com> (raw)
In-Reply-To: <4221b3fe-39ec-0108-3db5-aaa410c1f63c@virtuozzo.com>
On Mon, 2017-10-30 at 18:20 +0300, Vasily Averin wrote:
> restart_grace() still use hardcoded init_net.
> It can cause to "list_add double add" in following scenario:
>
> 1) nfsd and lockd was started in several net namespaces
> 2) nfsd in init_net was stopped (lockd was not stopped because
> it have users from another net namespaces)
> 3) lockd got signal, called restart_grace() -> set_grace_period()
> and enabled lock_manager in hardcoded init_net.
> 4) nfsd in init_net is started again,
> its lockd_up() calls set_grace_period() and tries to add lock_manager
> into init_net 2nd time.
>
> I do not understand how to fix this problem correctly.
>
> We can:
> 1) remove per-netns calls in restart_grace().
> However it was worked for init-net-only case for ages,
> and I afraid users of this functionality will object.
>
> 2) we can somehow provide reference to net namespace of process submitted handled signal
> and handle pointed net namespace only.
> However this time it isn't clear for me how to do it.
>
> 3) we can call per-netns operations for all existing net namespaces
> However I'm not sure is it expected behaviour.
> Also I afraid it can be racy with creation/destroy of net namespaces.
>
> 4) we can make lockd kernel thraad per net_ns, like nfsd.
> However this solution looks too heavy for this problem.
>
> Could you please advise some other solution?
>
> Thank you,
> Vasily Averin
The problem seems to be that list_add in locks_start_grace. It seems
like we only want to do that list_add if list_empty(&lm->list) is true.
We already do a list_del_init when removing from grace_list, and it
looks like both users of this API initialize their lists properly.
Is that enough of a fix or am I missing the bigger picture?
--
Jeff Layton <jlayton@redhat.com>
prev parent reply other threads:[~2017-10-30 17:20 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-30 15:20 init_net in restart_grace() Vasily Averin
2017-10-30 17:20 ` Jeff Layton [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=1509384007.5412.43.camel@redhat.com \
--to=jlayton@redhat.com \
--cc=bfields@fieldses.org \
--cc=linux-nfs@vger.kernel.org \
--cc=skinsbursky@virtuozzo.com \
--cc=vvs@virtuozzo.com \
/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.