net/mlx5: Fix fatal error handling during device load
authorShay Drory <shayd@mellanox.com>
Thu, 7 May 2020 06:32:53 +0000 (09:32 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 17 Jun 2020 14:40:32 +0000 (16:40 +0200)
commitb05f2b60213c51e83a1f40ee29662b980745b5af
treec2dd0ade7a76f38492510acb9560e33f826289f7
parentcd5d0278dcb150033365d9dc51cb6c33c24358f2
net/mlx5: Fix fatal error handling during device load

[ Upstream commit b6e0b6bebe0732d5cac51f0791f269d2413b8980 ]

Currently, in case of fatal error during mlx5_load_one(), we cannot
enter error state until mlx5_load_one() is finished, what can take
several minutes until commands will get timeouts, because these commands
can't be processed due to the fatal error.
Fix it by setting dev->state as MLX5_DEVICE_STATE_INTERNAL_ERROR before
requesting the lock.

Fixes: c1d4d2e92ad6 ("net/mlx5: Avoid calling sleeping function by the health poll thread")
Signed-off-by: Shay Drory <shayd@mellanox.com>
Reviewed-by: Moshe Shemesh <moshe@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/ethernet/mellanox/mlx5/core/health.c