[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1483723976.9712.19.camel@edumazet-glaptop3.roam.corp.google.com>
Date: Fri, 06 Jan 2017 09:32:56 -0800
From: Eric Dumazet <eric.dumazet@...il.com>
To: Michael Chan <michael.chan@...adcom.com>
Cc: davem@...emloft.net, netdev@...r.kernel.org
Subject: Re: [PATCH net] net: Fix inconsistent rtnl_lock usage on
dev_get_stats().
On Thu, 2017-01-05 at 23:21 -0500, Michael Chan wrote:
> Some callers take rtnl_lock() before calling dev_get_stats() and some
> don't. Most network drivers expect the ndo_get_stats64() to be called
> under rtnl_lock() to avoid race conditions with device close or ethtool
> reconfigurations. Fix it so that all callers take rtnl_lock().
>
> Rename the original dev_get_stats() as __dev_get_stats() and add a new
> dev_get_stats() that takes rtnl_lock() before calling __dev_get_stats().
> Modify all callers that already take rtnl_lock() to call __dev_get_stats().
This makes no sense to me.
RTNL is absolutely not needed to get device stats.
We try to not add RTNL, especially when not required.
Sure, RTNETLINK dumps currently hold RTNL, but we had various attempts
in the past to get rid of this behavior.
If a device driver expects RTNL being locked, it is clearly a bug that
needs a fix anyway.
Powered by blists - more mailing lists