[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <17268de9236e6e3c5bb118352984ec8638f0df4f.camel@redhat.com>
Date: Thu, 07 Oct 2021 16:16:19 +0200
From: Paolo Abeni <pabeni@...hat.com>
To: Antoine Tenart <atenart@...nel.org>, davem@...emloft.net,
kuba@...nel.org
Cc: juri.lelli@...hat.com, mhocko@...e.com, netdev@...r.kernel.org
Subject: Re: [PATCH net-next] net-sysfs: try not to restart the syscall if
it will fail eventually
On Thu, 2021-10-07 at 16:00 +0200, Antoine Tenart wrote:
> Due to deadlocks in the networking subsystem spotted 12 years ago[1],
> a workaround was put in place[2] to avoid taking the rtnl lock when it
> was not available and restarting the syscall (back to VFS, letting
> userspace spin). The following construction is found a lot in the net
> sysfs and sysctl code:
>
> if (!rtnl_trylock())
> return restart_syscall();
>
> This can be problematic when multiple userspace threads use such
> interfaces in a short period, making them to spin a lot. This happens
> for example when adding and moving virtual interfaces: userspace
> programs listening on events, such as systemd-udevd and NetworkManager,
> do trigger actions reading files in sysfs. It gets worse when a lot of
> virtual interfaces are created concurrently, say when creating
> containers at boot time.
>
> Returning early without hitting the above pattern when the syscall will
> fail eventually does make things better. While it is not a fix for the
> issue, it does ease things.
>
> [1] https://lore.kernel.org/netdev/49A4D5D5.5090602@trash.net/
> https://lore.kernel.org/netdev/m14oyhis31.fsf@fess.ebiederm.org/
> and https://lore.kernel.org/netdev/20090226084924.16cb3e08@nehalam/
> [2] Rightfully, those deadlocks are *hard* to solve.
>
> Signed-off-by: Antoine Tenart <atenart@...nel.org>
AFAICS, the current behaviour is preserved and the change is safe. I
think that preserving the current error-code for duplex_show and
speed_show is the correct thing to do.
Reviewed-by: Paolo Abeni <pabeni@...hat.com>
Powered by blists - more mailing lists