From: David Miller <davem@davemloft.net>
To: eric.dumazet@gmail.com
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH] net: ipv4: fix RCU races on dst refcounts
Date: Mon, 30 Jul 2012 17:40:44 -0700 (PDT) [thread overview]
Message-ID: <20120730.174044.968236168485282216.davem@davemloft.net> (raw)
In-Reply-To: <20120730.145637.906924670032055493.davem@davemloft.net>
From: David Miller <davem@davemloft.net>
Date: Mon, 30 Jul 2012 14:56:37 -0700 (PDT)
> From: Eric Dumazet <eric.dumazet@gmail.com>
> Date: Mon, 30 Jul 2012 11:20:37 +0200
>
>> From: Eric Dumazet <edumazet@google.com>
>>
>> We need instead regular dst refcounting (dst_release()) and make
>> sure dst_release() is aware of RCU grace periods :
Eric, we really cannot do this.
We absolutely must call dst_free() directly when cached entries
are flushed.
Your delayed scheme using dst_release() doesn't work, it exposes us to
the "stale netdevice references" issue even for cached entries. This
exact issue is why I moved away from a dst_release() based scheme to
a !DST_NOCACHE + dst_free() one.
dst_free() is special. It is special in that if there are existing
references, it adds the dst onto the generic GC list of busy dsts in
net/core/dst.c
This is important, because it means that even if references are still
held on the dst, we will still be able to purge spurious netdevice
references when those netdevices try to go down or unregister
themselves.
You can't defer the dst_free() to the final refcount drop like your
code does now. A socket, or other dst caching entity, can hold onto
the dst forever, do no socket operations at all, and therefore hold
onto a netdevice for an infinite amount of time.
Look at how net/core/dst.c:dst_dev_event() walks dst_busy_list.
That's why we must propagate cached dsts into dst_busy_list no later
than when we trim them from ->nh_rth_{input,output}
I noticed this because I'm trying to work on a fix the lingering dst
netdevice reference problem for non-cached dsts.
prev parent reply other threads:[~2012-07-31 0:40 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-30 9:20 [PATCH] net: ipv4: fix RCU races on dst refcounts Eric Dumazet
2012-07-30 21:56 ` David Miller
2012-07-31 0:40 ` David Miller [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=20120730.174044.968236168485282216.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=eric.dumazet@gmail.com \
--cc=netdev@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