linux/drivers
Hannes Reinecke 54718ee9b8 nvme: drop scan_lock and always kick requeue list when removing namespaces
[ Upstream commit 2b81a5f015 ]

When reading the partition table on initial scan hits an I/O error the
I/O will hang with the scan_mutex held:

[<0>] do_read_cache_page+0x49b/0x790
[<0>] read_part_sector+0x39/0xe0
[<0>] read_lba+0xf9/0x1d0
[<0>] efi_partition+0xf1/0x7f0
[<0>] bdev_disk_changed+0x1ee/0x550
[<0>] blkdev_get_whole+0x81/0x90
[<0>] blkdev_get_by_dev+0x128/0x2e0
[<0>] device_add_disk+0x377/0x3c0
[<0>] nvme_mpath_set_live+0x130/0x1b0 [nvme_core]
[<0>] nvme_mpath_add_disk+0x150/0x160 [nvme_core]
[<0>] nvme_alloc_ns+0x417/0x950 [nvme_core]
[<0>] nvme_validate_or_alloc_ns+0xe9/0x1e0 [nvme_core]
[<0>] nvme_scan_work+0x168/0x310 [nvme_core]
[<0>] process_one_work+0x231/0x420

and trying to delete the controller will deadlock as it tries to grab
the scan mutex:

[<0>] nvme_mpath_clear_ctrl_paths+0x25/0x80 [nvme_core]
[<0>] nvme_remove_namespaces+0x31/0xf0 [nvme_core]
[<0>] nvme_do_delete_ctrl+0x4b/0x80 [nvme_core]

As we're now properly ordering the namespace list there is no need to
hold the scan_mutex in nvme_mpath_clear_ctrl_paths() anymore.
And we always need to kick the requeue list as the path will be marked
as unusable and I/O will be requeued _without_ a current path.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Keith Busch <kbusch@kernel.org>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2021-11-18 19:16:18 +01:00
..
accessibility
acpi ACPI: scan: Release PM resources blocked by unused objects 2021-11-18 19:16:15 +01:00
amba ARM: 9120/1: Revert "amba: make use of -1 IRQs warn" 2021-11-06 14:13:31 +01:00
android binder: don't detect sender/target during buffer cleanup 2021-11-12 15:05:49 +01:00
ata libata: fix checking of DMA state 2021-11-18 19:16:00 +01:00
atm
auxdisplay
base component: do not leave master devres group open after bind 2021-11-18 19:16:08 +01:00
bcma Driver core update for 5.15-rc1 2021-09-01 08:44:42 -07:00
block floppy: fix calling platform_device_unregister() on invalid drives 2021-11-18 19:16:16 +01:00
bluetooth
bus Driver core fixes for 5.15-rc6 2021-10-17 17:17:28 -10:00
cdrom
char ipmi: Disable some operations during a panic 2021-11-18 19:16:13 +01:00
clk One fix for the composite clk that broke when we changed this clk type 2021-10-30 09:55:46 -07:00
clocksource - converted Pistachio platform to use MIPS generic kernel 2021-09-03 11:11:54 -07:00
comedi comedi: vmk80xx: fix bulk and interrupt message timeouts 2021-11-12 15:05:51 +01:00
connector
counter
cpufreq cpufreq: Make policy min/max hard requirements 2021-11-18 19:16:14 +01:00
cpuidle - Core Frameworks 2021-09-07 12:38:59 -07:00
crypto crypto: s5p-sss - Add error handling in s5p_aes_probe() 2021-11-18 19:15:53 +01:00
cxl cxl/pci: Fix NULL vs ERR_PTR confusion 2021-11-18 19:16:04 +01:00
dax libnvdimm for v5.15 2021-09-09 11:39:57 -07:00
dca
devfreq devfreq: use HZ macros 2021-09-08 11:50:26 -07:00
dio
dma dmaengine updates for v5.15-rc1 2021-09-09 11:07:47 -07:00
dma-buf dma-buf: WARN on dmabuf release with pending attachments 2021-11-18 19:16:08 +01:00
edac EDAC/sb_edac: Fix top-of-high-memory value for Broadwell/Haswell 2021-11-18 19:15:58 +01:00
eisa
extcon
firewire FireWire (IEEE 1394) subsystem updates: 2021-09-11 09:47:33 -07:00
firmware firmware/psci: fix application of sizeof to pointer 2021-11-18 19:15:53 +01:00
fpga fpga: ice40-spi: Add SPI device ID table 2021-09-27 14:00:41 -07:00
fsi
gnss
gpio gpio: mlxbf2.c: Add check for bgpio_init failure 2021-10-25 10:15:05 +02:00
gpu drm/amdgpu/pm: properly handle sclk for profiling modes on vangogh 2021-11-18 19:16:17 +01:00
greybus
hid HID: surface-hid: Allow driver matching for target ID 1 devices 2021-11-18 19:15:59 +01:00
hsi
hv hyperv-fixes for 5.15 2021-10-22 10:31:32 -10:00
hwmon hwmon: (pmbus/lm25066) Add offset coefficients 2021-11-18 19:15:57 +01:00
hwspinlock
hwtracing coresight: trbe: Defer the probe on offline CPUs 2021-11-18 19:16:06 +01:00
i2c i2c: mlxcpld: Modify register setting for 400KHz frequency 2021-10-04 21:56:20 +02:00
i3c
idle
iio iio: ad5770r: make devicetree property reading consistent 2021-11-18 19:16:07 +01:00
infiniband RDMA/qedr: Fix NULL deref for query_qp on the GSI QP 2021-11-18 19:16:01 +01:00
input Input: i8042 - Add quirk for Fujitsu Lifebook T725 2021-11-18 19:15:51 +01:00
interconnect interconnect: qcom: sdm660: Add missing a2noc qos clocks 2021-09-13 15:49:55 +03:00
iommu iommu/arm: fix ARM_SMMU_QCOM compilation 2021-10-13 21:28:44 +02:00
ipack ipack: ipoctal: fix module reference leak 2021-09-27 17:38:49 +02:00
irqchip irqchip/gic: Work around broken Renesas integration 2021-09-22 14:44:25 +01:00
isdn mISDN: Fix return values of the probe function 2021-10-19 13:09:28 +01:00
leds
macintosh memblock: introduce saner 'memblock_free_ptr()' interface 2021-09-14 13:23:22 -07:00
mailbox mailbox: cmdq: add multi-gce clocks support for mt8195 2021-08-31 22:57:45 -05:00
mcb mcb: fix error handling in mcb_alloc_bus() 2021-09-14 11:22:26 +02:00
md md: update superblock after changing rdev flags in state_store 2021-11-18 19:16:16 +01:00
media media: allegro: ignore interrupt if mailbox is not initialized 2021-11-18 19:16:17 +01:00
memory memory: renesas-rpc-if: Correct QSPI data transfer in Manual mode 2021-11-18 19:16:01 +01:00
memstick memstick: r592: Fix a UAF bug when removing the driver 2021-11-18 19:16:16 +01:00
message
mfd mfd: simple-mfd-i2c: Select MFD_CORE to fix build error 2021-11-18 19:16:06 +01:00
misc eeprom: 93xx46: fix MODULE_DEVICE_TABLE 2021-10-15 10:54:02 +02:00
mmc mmc: moxart: Fix reference count leaks in moxart_probe 2021-11-18 19:16:15 +01:00
most most: fix control-message timeouts 2021-11-18 19:16:08 +01:00
mtd mtd: rawnand: socrates: Keep the driver compatible with on-die ECC engines 2021-11-18 19:16:02 +01:00
mux
net iwlwifi: change all JnP to NO-160 configuration 2021-11-18 19:16:17 +01:00
nfc nfc: port100: fix using -ERRNO as command type mask 2021-10-26 13:42:00 +01:00
ntb Bug fixes and clean-ups for Linux v5.15 2021-09-07 13:05:02 -07:00
nubus
nvdimm nvdimm/pmem: stop using q_usage_count as external pgmap refcount 2021-10-25 16:12:32 -07:00
nvme nvme: drop scan_lock and always kick requeue list when removing namespaces 2021-11-18 19:16:18 +01:00
nvmem nvmem: Fix shift-out-of-bound (UBSAN) with byte size cells 2021-10-13 15:09:58 +02:00
of memblock: exclude MEMBLOCK_NOMAP regions from kmemleak 2021-10-21 18:30:49 -10:00
opp Merge branches 'pm-pci', 'pm-sleep', 'pm-domains' and 'powercap' 2021-08-30 19:25:42 +02:00
parisc parisc: Move pci_dev_is_behind_card_dino to where it is used 2021-09-09 12:44:31 +02:00
parport parisc architecture updates for kernel 5.15: 2021-09-02 13:16:00 -07:00
pci PCI: aardvark: Fix support for PCI_ROM_ADDRESS1 on emulated bridge 2021-11-18 19:16:05 +01:00
pcmcia
perf KVM: arm64: Fix PMU probe ordering 2021-09-20 12:43:34 +01:00
phy Merge branch 'akpm' (patches from Andrew) 2021-09-08 12:55:35 -07:00
pinctrl pinctrl: core: fix possible memory leak in pinctrl_enable() 2021-11-18 19:16:06 +01:00
platform platform/x86: wmi: do not fail if disabling fails 2021-11-18 19:16:09 +01:00
pnp
power power: supply: max17042_battery: Clear status bits in interrupt handler 2021-11-18 19:16:08 +01:00
powercap powercap: Add Power Limit4 support for Alder Lake SoC 2021-08-25 20:12:16 +02:00
pps
ps3
ptp ptp: free 'vclock_index' in ptp_clock_release() 2021-10-21 12:50:38 +01:00
pwm pwm: mtk-disp: Implement atomic API .get_state() 2021-09-02 22:27:46 +02:00
rapidio
ras
regulator regulator: s5m8767: do not use reset value as DVS voltage if GPIO DVS is disabled 2021-11-18 19:15:57 +01:00
remoteproc
reset reset: socfpga: add empty driver allowing consumers to probe 2021-10-05 12:23:16 +02:00
rpmsg
rtc rtc: cmos: Disable irq around direct invocation of cmos_interrupt() 2021-09-14 10:20:19 +02:00
s390 s390 updates for 5.15-rc4 2021-10-01 14:45:23 -07:00
sbus
scsi scsi: qla2xxx: Fix use after free in eh_abort path 2021-11-18 19:15:52 +01:00
sh
siox
slimbus Driver core update for 5.15-rc1 2021-09-01 08:44:42 -07:00
soc soc: fsl: dpio: use the combined functions to protect critical zone 2021-11-18 19:16:01 +01:00
soundwire sound updates for 5.15-rc1 2021-09-01 10:29:29 -07:00
spi spi: Check we have a spi_device_id for each DT compatible 2021-11-18 19:16:11 +01:00
spmi
ssb
staging media: ipu3-imgu: VIDIOC_QUERYCAP: Fix bus_info 2021-11-18 19:16:14 +01:00
target scsi: target: Fix spelling mistake "CONFLIFT" -> "CONFLICT" 2021-09-22 00:17:29 -04:00
tc
tee tee: optee: Fix missing devices unregister during optee_remove 2021-10-12 13:24:39 +02:00
thermal thermal/drivers/tsens: Add timeout to get_temp_tsens_valid 2021-11-18 19:16:16 +01:00
thunderbolt thunderbolt: build kunit tests without structleak plugin 2021-10-06 17:53:49 -06:00
tty Revert "serial: 8250: Fix reporting real baudrate value in c_ospeed field" 2021-11-18 19:16:08 +01:00
uio
usb USB: chipidea: fix interrupt deadlock 2021-11-18 19:16:08 +01:00
vdpa vduse: Fix race condition between resetting and irq injecting 2021-10-22 06:49:14 -04:00
vfio vfio/pci: add missing identifier name in argument of function prototype 2021-09-23 14:12:36 -06:00
vhost virtio,vdpa: fixes 2021-10-17 18:17:19 -10:00
video video: fbdev: gbefb: Only instantiate device when built for IP32 2021-10-06 11:12:28 +02:00
virt
virtio virtio-ring: fix DMA metadata flags 2021-10-27 15:54:34 -04:00
visorbus
vlynq
vme
w1
watchdog watchdog: Fix OMAP watchdog early handling 2021-10-26 20:22:51 +02:00
xen xen/balloon: add late_initcall_sync() for initial ballooning done 2021-11-18 19:16:04 +01:00
zorro
Kconfig firmware: include drivers/firmware/Kconfig unconditionally 2021-10-07 16:51:26 +02:00
Makefile