From: Simon Horman <horms@verge.net.au>
To: Hans Schillstrom <hans.schillstrom@ericsson.com>
Cc: ja@ssi.bg, wensong@linux-vs.org, lvs-devel@vger.kernel.org,
netdev@vger.kernel.org, netfilter-devel@vger.kernel.org,
hans@schillstrom.com
Subject: Re: [RFC PATCH 1/1] IPVS netns shutdown/startup dead-lock
Date: Mon, 13 Jun 2011 20:11:29 +0900 [thread overview]
Message-ID: <20110613111126.GA1502@verge.net.au> (raw)
In-Reply-To: <1307957530-12732-1-git-send-email-hans.schillstrom@ericsson.com>
On Mon, Jun 13, 2011 at 11:32:10AM +0200, Hans Schillstrom wrote:
> ip_vs_mutext is used by both netns shutdown code and startup
> and both implicit uses sk_lock-AF_INET mutex.
>
> cleanup CPU-1 startup CPU-2
> ip_vs_dst_event() ip_vs_genl_set_cmd()
> sk_lock-AF_INET __ip_vs_mutex
> sk_lock-AF_INET
> __ip_vs_mutex
> * DEAD LOCK *
>
> This can be solved by have the ip_vs_mutex per netns
> or avid locking when starting/stoping sync-threads.
> i.e. just add a starting/stoping flag.
>
> ip_vs_mutex per name-space seems to be a more future proof solution.
>
> Which one should be used ?
I don't feel strongly either way.
> Signed-off-by: Hans Schillstrom <hans.schillstrom@ericsson.com>
> ---
> include/net/ip_vs.h | 2 ++
> net/netfilter/ipvs/ip_vs_ctl.c | 15 ++++++++++-----
> net/netfilter/ipvs/ip_vs_sync.c | 30 +++++++++++++++++++++++++-----
> 3 files changed, 37 insertions(+), 10 deletions(-)
>
[snip]
> diff --git a/net/netfilter/ipvs/ip_vs_ctl.c b/net/netfilter/ipvs/ip_vs_ctl.c
> index 699c79a..21c541f 100644
> --- a/net/netfilter/ipvs/ip_vs_ctl.c
> +++ b/net/netfilter/ipvs/ip_vs_ctl.c
[snip]
> @@ -3305,12 +3309,13 @@ static int ip_vs_genl_set_cmd(struct sk_buff *skb, struct genl_info *info)
> ret = -EINVAL;
> goto out;
> }
> -
> + /* Unlock since a global socket lock will be taken later */
> + mutex_unlock(&__ip_vs_mutex);
> if (cmd == IPVS_CMD_NEW_DAEMON)
> ret = ip_vs_genl_new_daemon(net, daemon_attrs);
> else
> ret = ip_vs_genl_del_daemon(net, daemon_attrs);
> - goto out;
> + goto out_nounlock;
I'm not a huge fan of labels that only return.
So I think it would be slightly easier on the eyes
to just return here, not add out_nounlock,
and possibly rename out as out_unlock.
> } else if (cmd == IPVS_CMD_ZERO &&
> !info->attrs[IPVS_CMD_ATTR_SERVICE]) {
> ret = ip_vs_zero_all(net);
[snip]
next prev parent reply other threads:[~2011-06-13 11:11 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-13 9:32 [RFC PATCH 1/1] IPVS netns shutdown/startup dead-lock Hans Schillstrom
2011-06-13 11:11 ` Simon Horman [this message]
2011-06-13 21:25 ` Julian Anastasov
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=20110613111126.GA1502@verge.net.au \
--to=horms@verge.net.au \
--cc=hans.schillstrom@ericsson.com \
--cc=hans@schillstrom.com \
--cc=ja@ssi.bg \
--cc=lvs-devel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=netfilter-devel@vger.kernel.org \
--cc=wensong@linux-vs.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