]> git.baikalelectronics.ru Git - kernel.git/commit
devlink: Change devlink health locking mechanism
authorMoshe Shemesh <moshe@mellanox.com>
Mon, 29 Apr 2019 09:41:45 +0000 (12:41 +0300)
committerDavid S. Miller <davem@davemloft.net>
Wed, 1 May 2019 15:07:03 +0000 (11:07 -0400)
commitc9d1550c7b942710f7f24c5c7570f76ff717da8a
tree506edca56c4af13657e8f1136b5de7e9c4784960
parent807877bd351d9d40e96cf8465456fdb3637f1833
devlink: Change devlink health locking mechanism

The devlink health reporters create/destroy and user commands currently
use the devlink->lock as a locking mechanism. Different reporters have
different rules in the driver and are being created/destroyed during
different stages of driver load/unload/running. So during execution of a
reporter recover the flow can go through another reporter's destroy and
create. Such flow leads to deadlock trying to lock a mutex already
held.

With the new locking mechanism the different reporters share mutex lock
only to protect access to shared reporters list.
Added refcount per reporter, to protect the reporters from destroy while
being used.

Signed-off-by: Moshe Shemesh <moshe@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Acked-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/devlink.h
net/core/devlink.c