From: "J. Bruce Fields" <bfields@fieldses.org>
To: Vasily Averin <vvs@virtuozzo.com>
Cc: Jeff Layton <jlayton@kernel.org>, linux-nfs@vger.kernel.org
Subject: Re: [PATCH] grace: only add lock_manager to grace_list if it's not already there
Date: Thu, 9 Nov 2017 10:44:44 -0500 [thread overview]
Message-ID: <20171109154444.GG8773@fieldses.org> (raw)
In-Reply-To: <62d9a66b-abd3-aba9-121f-e9dac7c8f1b4@virtuozzo.com>
On Wed, Nov 01, 2017 at 01:10:36PM +0300, Vasily Averin wrote:
>
>
> On 2017-11-01 00:18, J. Bruce Fields wrote:
> > On Tue, Oct 31, 2017 at 10:31:35AM +0300, Vasily Averin wrote:
> >> On 2017-10-30 21:29, Jeff Layton wrote:
> >>> Vasily, would this patch fix the panic you're seeing? We may still
> >>> need to do something saner here, but this seems like it should at
> >>> least prevent a double list_add.
> >>
> >> Jeff, I think your patch is wrong.
> >>
> >> Double list_add is not a real problem, it is just a marker of its presence.
> >> It's great that such marker exist, it allows to detect the problems.
>
> Jeff, what do you about about following hunk ?
>
> --- a/fs/nfs_common/grace.c
> +++ b/fs/nfs_common/grace.c
> @@ -30,7 +30,11 @@ locks_start_grace(struct net *net, struct lock_manager *lm)
> struct list_head *grace_list = net_generic(net, grace_net_id);
>
> spin_lock(&grace_lock);
> - list_add(&lm->list, grace_list);
> + if (list_empty(&lm->list))
> + list_add(&lm->list, grace_list);
> + else
> + WARN(1, "double list_add attempt detected in %s %p\n",
> + (net == &init_net) ? "init_net" : "net", net);
> spin_unlock(&grace_lock);
> }
> EXPORT_SYMBOL_GPL(locks_start_grace);
>
> It allows to avoid list corruption and panic
> but will report about detected problem
>
> [ 344.722040] double list_add attempt detected in init_net ffffffffa4fd9800
> [ 344.722108] ------------[ cut here ]------------
> [ 344.722142] WARNING: CPU: 3 PID: 1505 at fs/nfs_common/grace.c:37 locks_start_grace+0xa2/0xb0 [grace]
>
>
> I think by same way we can also detect and disarm lost delayed_work on stop of network namespace.
> (in lockd_exit_net)
Jeff, were you planning to resend this?
--b.
next prev parent reply other threads:[~2017-11-09 15:44 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-30 18:29 [PATCH] grace: only add lock_manager to grace_list if it's not already there Jeff Layton
2017-10-31 7:31 ` Vasily Averin
2017-10-31 21:18 ` J. Bruce Fields
2017-11-01 10:10 ` Vasily Averin
2017-11-09 15:44 ` J. Bruce Fields [this message]
2017-11-13 4:25 ` [PATCH] lockd: fix "list_add double add" caused by legacy signal interface Vasily Averin
2017-11-13 11:49 ` Jeff Layton
2017-11-13 14:57 ` Vasily Averin
2017-11-13 20:06 ` Jeff Layton
2017-11-14 0:46 ` 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=20171109154444.GG8773@fieldses.org \
--to=bfields@fieldses.org \
--cc=jlayton@kernel.org \
--cc=linux-nfs@vger.kernel.org \
--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 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).