From: Eyal Birger <eyal.birger@gmail.com>
To: Xin Long <lucien.xin@gmail.com>
Cc: Steffen Klassert <steffen.klassert@secunet.com>,
Herbert Xu <herbert@gondor.apana.org.au>,
Wei Wang <weiwan@google.com>, davem <davem@davemloft.net>,
network dev <netdev@vger.kernel.org>,
Florian Westphal <fw@strlen.de>,
shmulik@metanetworks.com, shannon.nelson@oracle.com
Subject: Re: [PATCH ipsec,v3] net: xfrm_policy: fix device unregistration hang
Date: Tue, 13 Feb 2018 20:23:14 +0200 [thread overview]
Message-ID: <20180213202314.23dc5d55@jimi> (raw)
In-Reply-To: <CADvbK_d4P7mfy13ebVnv=zxnN1pDzhEir2kx8C9AEwQVsQETng@mail.gmail.com>
Hi Xin Long,
On Tue, 13 Feb 2018 23:18:14 +0800
Xin Long <lucien.xin@gmail.com> wrote:
> On Tue, Feb 13, 2018 at 6:54 PM, Eyal Birger <eyal.birger@gmail.com>
> wrote:
> > In setups like the following:
> >
> > Host A -- Host B
> > tun0 -- ipsec -- eth0 -- eth0 -- ipsec -- tun0
> >
> > where tun0 are tunnel devices using dst_cache (ipip, ipip6, etc...).
> >
> > Unregistration of an underlying eth0 device leads to the following
> > log messages:
> >
> > unregister_netdevice: waiting for eth0 to become free. Usage count
> > = 2
> >
> > This is since xfrm dsts device references are not released upon
> > device unregistration when the xfrm dst is cached in a dst_cache.
> >
> > This issue was first introduced in commit 52df157f17e5
> > ("xfrm: take refcnt of dst when creating struct xfrm_dst bundle")
> > as part of an effort to remove routing garbage collection.
> >
> > Several approaches for fixing this were discussed in [1]; this
> > commit keeps track of allocated xdsts and releases their device
> > references on a netdev unregister/down events.
> >
> > Signed-off-by: Eyal Birger <eyal.birger@gmail.com>
> > Fixes: 52df157f17e5 ("xfrm: take refcnt of dst when creating struct
> > xfrm_dst bundle")
> I had another fix [1] for this issue in my local tree.
> That reuses uncached_list to track xdsts, and fewer job to do for
> this. As naturally uncached_list is already the list that is supposed
> to do this job. We don't have to introduce a new list and members.
>
> [1] https://paste.fedoraproject.org/paste/X8FQzEXjGXQBTKAVLnDn4w
I have tested your patch and it resolves the issue described.
I like not having to introduce a new list and lock.
Small note: I think you need to increase net->ipv6.rt6_stats->fib_rt_uncache
when adding to the IPv6 uncached list from the xfrm code.
>
> Not sure if it makes more sense for xfrm?
I wasn't sure whether xfrm may use the uncached list.
But it looks correct to me.
Eyal.
next prev parent reply other threads:[~2018-02-13 18:23 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-13 10:54 [PATCH ipsec,v3] net: xfrm_policy: fix device unregistration hang Eyal Birger
2018-02-13 15:18 ` Xin Long
2018-02-13 18:23 ` Eyal Birger [this message]
2018-02-14 9:24 ` Steffen Klassert
2018-02-14 9:55 ` Xin Long
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=20180213202314.23dc5d55@jimi \
--to=eyal.birger@gmail.com \
--cc=davem@davemloft.net \
--cc=fw@strlen.de \
--cc=herbert@gondor.apana.org.au \
--cc=lucien.xin@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=shannon.nelson@oracle.com \
--cc=shmulik@metanetworks.com \
--cc=steffen.klassert@secunet.com \
--cc=weiwan@google.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).