linux/drivers
Maurizio Lombardi 2bff487f9a nvme-tcp: check if the queue is allocated before stopping it
When an error is detected and the host reconnects, the
nvme_tcp_error_recovery_work() function is called and starts
tearing down the io queues and de-allocating them;
If at the same time the "nvme" process deletes the controller via sysfs,
the nvme_tcp_delete_ctrl() gets called and waits until the
nvme_tcp_error_recovery_work() finishes its job; then starts
tearing down the io queues, but at this point they have already
been freed and the mutexes are destroyed.

Calling mutex_lock() against a destroyed mutex triggers a warning:

[ 1299.025575] nvme nvme1: Reconnecting in 10 seconds...
[ 1299.636449] nvme nvme1: Removing ctrl: NQN "blktests-subsystem-1"
[ 1299.645262] ------------[ cut here ]------------
[ 1299.649949] DEBUG_LOCKS_WARN_ON(lock->magic != lock)
[ 1299.649971] WARNING: CPU: 4 PID: 104150 at kernel/locking/mutex.c:579 __mutex_lock+0x2d0/0x7dc

[ 1299.717934] CPU: 4 PID: 104150 Comm: nvme
[ 1299.828075] Call trace:
[ 1299.830526]  __mutex_lock+0x2d0/0x7dc
[ 1299.834203]  mutex_lock_nested+0x64/0xd4
[ 1299.838139]  nvme_tcp_stop_queue+0x54/0xe0 [nvme_tcp]
[ 1299.843211]  nvme_tcp_teardown_io_queues.part.0+0x90/0x280 [nvme_tcp]
[ 1299.849672]  nvme_tcp_delete_ctrl+0x6c/0xf0 [nvme_tcp]
[ 1299.854831]  nvme_do_delete_ctrl+0x108/0x120 [nvme_core]
[ 1299.860181]  nvme_sysfs_delete+0xec/0xf0 [nvme_core]
[ 1299.865179]  dev_attr_store+0x40/0x70

Fix the warning by checking if the queues are allocated
in the nvme_tcp_stop_queue(). If they are not, it makes no
sense to try to stop them.

Signed-off-by: Maurizio Lombardi <mlombard@redhat.com>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Christoph Hellwig <hch@lst.de>
2022-08-10 16:21:31 +02:00
..
accessibility
acpi pci-v5.20-changes 2022-08-04 19:30:35 -07:00
amba ARM: 9220/1: amba: Remove deferred device addition 2022-07-28 15:09:23 +01:00
android
ata ATA changes for 5.20-rc1 2022-08-03 15:26:04 -07:00
atm
auxdisplay
base Driver core / kernfs changes for 6.0-rc1 2022-08-04 11:31:20 -07:00
bcma
block ublk_drv: add support for UBLK_IO_NEED_GET_DATA 2022-08-02 21:13:40 -06:00
bluetooth SPDX changes for 6.0-rc1 2022-08-04 12:12:54 -07:00
bus SPDX changes for 6.0-rc1 2022-08-04 12:12:54 -07:00
cdrom
char SPDX changes for 6.0-rc1 2022-08-04 12:12:54 -07:00
clk The clk core gains a new set of APIs that allow drivers to both acquire clks 2022-08-04 18:40:08 -07:00
clocksource - Add the missing DT bindings for the MTU nomadik timer (Linus 2022-07-28 12:33:34 +02:00
comedi pci-v5.20-changes 2022-08-04 19:30:35 -07:00
connector
counter
cpufreq SPDX changes for 6.0-rc1 2022-08-04 12:12:54 -07:00
cpuidle SPDX changes for 6.0-rc1 2022-08-04 12:12:54 -07:00
crypto This update includes the following changes: 2022-08-02 17:45:14 -07:00
cxl
dax
dca
devfreq Char / Misc driver changes for 6.0-rc1 2022-08-04 11:05:48 -07:00
dio
dma pci-v5.20-changes 2022-08-04 19:30:35 -07:00
dma-buf drm for 5.20/6.0 2022-08-03 19:52:08 -07:00
edac platform-drivers-x86 for v6.0-1 2022-08-04 18:19:14 -07:00
eisa
extcon
firewire firewire: net: Make use of get_unaligned_be48(), put_unaligned_be48() 2022-07-28 22:21:54 -07:00
firmware Char / Misc driver changes for 6.0-rc1 2022-08-04 11:05:48 -07:00
fpga
fsi
gnss
gpio gpio: updates for v6.0-rc1 2022-08-04 18:34:05 -07:00
gpu drm/amd/amdgpu: fix build failure due to implicit declaration 2022-08-04 12:29:10 -07:00
greybus
hid platform-drivers-x86 for v6.0-1 2022-08-04 18:19:14 -07:00
hsi
hte
hv
hwmon hwmon updates for v5.20 2022-08-02 11:07:04 -07:00
hwspinlock
hwtracing
i2c platform-drivers-x86 for v6.0-1 2022-08-04 18:19:14 -07:00
i3c
idle Power management updates for 5.20-rc1 2022-08-02 11:17:00 -07:00
iio
infiniband v5.20 pull request 2022-08-04 19:54:32 -07:00
input SPDX changes for 6.0-rc1 2022-08-04 12:12:54 -07:00
interconnect
iommu Driver core / kernfs changes for 6.0-rc1 2022-08-04 11:31:20 -07:00
ipack
irqchip SPDX changes for 6.0-rc1 2022-08-04 12:12:54 -07:00
isdn
leds
macintosh
mailbox
mcb
md for-5.20/block-2022-08-04 2022-08-04 20:00:14 -07:00
media SPDX changes for 6.0-rc1 2022-08-04 12:12:54 -07:00
memory SPDX changes for 6.0-rc1 2022-08-04 12:12:54 -07:00
memstick MMC core: 2022-08-04 19:41:09 -07:00
message
mfd gpio: updates for v6.0-rc1 2022-08-04 18:34:05 -07:00
misc Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/egtvedt/linux-avr32 2022-08-04 15:20:39 -07:00
mmc MMC core: 2022-08-04 19:41:09 -07:00
most
mtd for-5.20/block-2022-07-29 2022-08-02 13:46:35 -07:00
mux
net v5.20 pull request 2022-08-04 19:54:32 -07:00
nfc
ntb
nubus
nvdimm for-5.20/block-2022-07-29 2022-08-02 13:46:35 -07:00
nvme nvme-tcp: check if the queue is allocated before stopping it 2022-08-10 16:21:31 +02:00
nvmem SPDX changes for 6.0-rc1 2022-08-04 12:12:54 -07:00
of Devicetree updates for v6.0: 2022-08-04 18:08:34 -07:00
opp
parisc
parport
pci pci-v5.20-changes 2022-08-04 19:30:35 -07:00
pcmcia
peci
perf
phy pci-v5.20-changes 2022-08-04 19:30:35 -07:00
pinctrl platform-drivers-x86 for v6.0-1 2022-08-04 18:19:14 -07:00
platform platform-drivers-x86 for v6.0-1 2022-08-04 18:19:14 -07:00
pnp
power platform-drivers-x86 for v6.0-1 2022-08-04 18:19:14 -07:00
powercap Power management updates for 5.20-rc1 2022-08-02 11:17:00 -07:00
pps
ps3
ptp SPDX changes for 6.0-rc1 2022-08-04 12:12:54 -07:00
pwm SPDX changes for 6.0-rc1 2022-08-04 12:12:54 -07:00
rapidio
ras
regulator chrome platform changes for 5.20 2022-08-04 18:13:19 -07:00
remoteproc
reset SPDX changes for 6.0-rc1 2022-08-04 12:12:54 -07:00
rpmsg
rtc
s390 for-5.20/block-2022-08-04 2022-08-04 20:00:14 -07:00
sbus
scsi SCSI misc on 20220804 2022-08-04 19:47:37 -07:00
sh
siox
slimbus
soc SPDX changes for 6.0-rc1 2022-08-04 12:12:54 -07:00
soundwire Char / Misc driver changes for 6.0-rc1 2022-08-04 11:05:48 -07:00
spi Driver core / kernfs changes for 6.0-rc1 2022-08-04 11:31:20 -07:00
spmi
ssb
staging Staging driver patches for 6.0-rc1 2022-08-04 12:01:42 -07:00
target SCSI misc on 20220804 2022-08-04 19:47:37 -07:00
tc
tee
thermal SPDX changes for 6.0-rc1 2022-08-04 12:12:54 -07:00
thunderbolt USB / Thunderbolt changes for 6.0-rc1 2022-08-04 11:41:28 -07:00
tty ARM: SoC drivers for 6.0 2022-08-02 08:10:10 -07:00
ufs SCSI misc on 20220804 2022-08-04 19:47:37 -07:00
uio
usb Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/egtvedt/linux-avr32 2022-08-04 15:20:39 -07:00
vdpa
vfio ARM: 2022-08-04 14:59:54 -07:00
vhost
video Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/egtvedt/linux-avr32 2022-08-04 15:20:39 -07:00
virt Char / Misc driver changes for 6.0-rc1 2022-08-04 11:05:48 -07:00
virtio xen: branch for v6.0-rc1 2022-08-04 15:10:55 -07:00
vlynq
w1
watchdog platform-drivers-x86 for v6.0-1 2022-08-04 18:19:14 -07:00
xen xen: branch for v6.0-rc1 2022-08-04 15:10:55 -07:00
zorro
Kconfig
Makefile Staging driver patches for 6.0-rc1 2022-08-04 12:01:42 -07:00