linux/drivers/ata
Damien Le Moal 6aa0365a3c ata: libata-scsi: Avoid deadlock on rescan after device resume
When an ATA port is resumed from sleep, the port is reset and a power
management request issued to libata EH to reset the port and rescanning
the device(s) attached to the port. Device rescanning is done by
scheduling an ata_scsi_dev_rescan() work, which will execute
scsi_rescan_device().

However, scsi_rescan_device() takes the generic device lock, which is
also taken by dpm_resume() when the SCSI device is resumed as well. If
a device rescan execution starts before the completion of the SCSI
device resume, the rcu locking used to refresh the cached VPD pages of
the device, combined with the generic device locking from
scsi_rescan_device() and from dpm_resume() can cause a deadlock.

Avoid this situation by changing struct ata_port scsi_rescan_task to be
a delayed work instead of a simple work_struct. ata_scsi_dev_rescan() is
modified to check if the SCSI device associated with the ATA device that
must be rescanned is not suspended. If the SCSI device is still
suspended, ata_scsi_dev_rescan() returns early and reschedule itself for
execution after an arbitrary delay of 5ms.

Reported-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
Reported-by: Joe Breuer <linux-kernel@jmbreuer.net>
Closes: https://bugzilla.kernel.org/show_bug.cgi?id=217530
Fixes: a19a93e4c6 ("scsi: core: pm: Rely on the device driver core for async power management")
Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Tested-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
Tested-by: Joe Breuer <linux-kernel@jmbreuer.net>
2023-06-18 12:00:49 +09:00
..
pata_parport Driver core changes for 6.4-rc1 2023-04-27 11:53:57 -07:00
acard-ahci.c scsi: ata: Declare SCSI host templates const 2023-03-24 19:19:19 -04:00
ahci_brcm.c scsi: ata: Declare SCSI host templates const 2023-03-24 19:19:19 -04:00
ahci_ceva.c scsi: ata: Declare SCSI host templates const 2023-03-24 19:19:19 -04:00
ahci_da850.c scsi: ata: Declare SCSI host templates const 2023-03-24 19:19:19 -04:00
ahci_dm816.c scsi: ata: Declare SCSI host templates const 2023-03-24 19:19:19 -04:00
ahci_dwc.c scsi: ata: Declare SCSI host templates const 2023-03-24 19:19:19 -04:00
ahci_imx.c SCSI misc on 20230426 2023-04-26 15:39:25 -07:00
ahci_mtk.c SCSI misc on 20230426 2023-04-26 15:39:25 -07:00
ahci_mvebu.c scsi: ata: Declare SCSI host templates const 2023-03-24 19:19:19 -04:00
ahci_octeon.c ata: octeon: Drop empty platform remove function 2023-01-03 08:39:41 +09:00
ahci_platform.c scsi: ata: Declare SCSI host templates const 2023-03-24 19:19:19 -04:00
ahci_qoriq.c scsi: ata: Declare SCSI host templates const 2023-03-24 19:19:19 -04:00
ahci_seattle.c scsi: ata: Declare SCSI host templates const 2023-03-24 19:19:19 -04:00
ahci_st.c scsi: ata: Declare SCSI host templates const 2023-03-24 19:19:19 -04:00
ahci_sunxi.c scsi: ata: Declare SCSI host templates const 2023-03-24 19:19:19 -04:00
ahci_tegra.c scsi: ata: Declare SCSI host templates const 2023-03-24 19:19:19 -04:00
ahci_xgene.c scsi: ata: Declare SCSI host templates const 2023-03-24 19:19:19 -04:00
ahci.c scsi: ata: Declare SCSI host templates const 2023-03-24 19:19:19 -04:00
ahci.h scsi: ata: Declare SCSI host templates const 2023-03-24 19:19:19 -04:00
ata_generic.c scsi: ata: Declare SCSI host templates const 2023-03-24 19:19:19 -04:00
ata_piix.c scsi: ata: Declare SCSI host templates const 2023-03-24 19:19:19 -04:00
Kconfig ahci: qoriq: Add platform dependencies 2023-03-23 10:29:26 +09:00
libahci_platform.c SCSI misc on 20230426 2023-04-26 15:39:25 -07:00
libahci.c scsi: ata: Declare SCSI host templates const 2023-03-24 19:19:19 -04:00
libata-acpi.c ata: make use of ata_port_is_frozen() helper 2022-10-18 13:53:27 +09:00
libata-core.c ata: libata-scsi: Avoid deadlock on rescan after device resume 2023-06-18 12:00:49 +09:00
libata-eh.c ata: libata-scsi: Avoid deadlock on rescan after device resume 2023-06-18 12:00:49 +09:00
libata-pata-timings.c ata: separate PATA timings code from libata-core.c 2020-03-26 10:28:19 -06:00
libata-pmp.c ata: libata: add tracepoints for ATA error handling 2022-01-05 19:33:01 +09:00
libata-sata.c ata: libata: read the shared status for successful NCQ commands once 2023-01-04 13:38:14 +09:00
libata-scsi.c ata: libata-scsi: Avoid deadlock on rescan after device resume 2023-06-18 12:00:49 +09:00
libata-sff.c scsi: ata: Declare SCSI host templates const 2023-03-24 19:19:19 -04:00
libata-trace.c ata: scsi: rename flag ATA_QCFLAG_FAILED to ATA_QCFLAG_EH 2023-01-04 13:36:26 +09:00
libata-transport.c ata: libata-transport: fix error handling in ata_tdev_add() 2022-11-11 17:26:05 +09:00
libata-transport.h
libata-zpodd.c libata: zpodd: Fix small read overflow in zpodd_get_mech_type() 2019-07-29 16:00:14 -06:00
libata.h scsi: ata: Declare SCSI host templates const 2023-03-24 19:19:19 -04:00
Makefile ATA changes for 6.3-rc1 2023-02-22 13:35:51 -08:00
pata_acpi.c scsi: ata: Declare SCSI host templates const 2023-03-24 19:19:19 -04:00
pata_ali.c scsi: ata: Declare SCSI host templates const 2023-03-24 19:19:19 -04:00
pata_amd.c scsi: ata: Declare SCSI host templates const 2023-03-24 19:19:19 -04:00
pata_arasan_cf.c scsi: ata: Declare SCSI host templates const 2023-03-24 19:19:19 -04:00
pata_artop.c scsi: ata: Declare SCSI host templates const 2023-03-24 19:19:19 -04:00
pata_atiixp.c scsi: ata: Declare SCSI host templates const 2023-03-24 19:19:19 -04:00
pata_atp867x.c scsi: ata: Declare SCSI host templates const 2023-03-24 19:19:19 -04:00
pata_buddha.c scsi: ata: Declare SCSI host templates const 2023-03-24 19:19:19 -04:00
pata_cmd64x.c scsi: ata: Declare SCSI host templates const 2023-03-24 19:19:19 -04:00
pata_cmd640.c scsi: ata: Declare SCSI host templates const 2023-03-24 19:19:19 -04:00
pata_cs5520.c scsi: ata: Declare SCSI host templates const 2023-03-24 19:19:19 -04:00
pata_cs5530.c scsi: ata: Declare SCSI host templates const 2023-03-24 19:19:19 -04:00
pata_cs5535.c scsi: ata: Declare SCSI host templates const 2023-03-24 19:19:19 -04:00
pata_cs5536.c scsi: ata: Declare SCSI host templates const 2023-03-24 19:19:19 -04:00
pata_cypress.c scsi: ata: Declare SCSI host templates const 2023-03-24 19:19:19 -04:00
pata_efar.c scsi: ata: Declare SCSI host templates const 2023-03-24 19:19:19 -04:00
pata_ep93xx.c scsi: ata: Declare SCSI host templates const 2023-03-24 19:19:19 -04:00
pata_falcon.c scsi: ata: Declare SCSI host templates const 2023-03-24 19:19:19 -04:00
pata_ftide010.c scsi: ata: Declare SCSI host templates const 2023-03-24 19:19:19 -04:00
pata_gayle.c scsi: ata: Declare SCSI host templates const 2023-03-24 19:19:19 -04:00
pata_hpt3x2n.c scsi: ata: Declare SCSI host templates const 2023-03-24 19:19:19 -04:00
pata_hpt3x3.c scsi: ata: Declare SCSI host templates const 2023-03-24 19:19:19 -04:00
pata_hpt37x.c scsi: ata: Declare SCSI host templates const 2023-03-24 19:19:19 -04:00
pata_hpt366.c scsi: ata: Declare SCSI host templates const 2023-03-24 19:19:19 -04:00
pata_icside.c scsi: ata: Declare SCSI host templates const 2023-03-24 19:19:19 -04:00
pata_imx.c scsi: ata: Declare SCSI host templates const 2023-03-24 19:19:19 -04:00
pata_isapnp.c scsi: ata: Declare SCSI host templates const 2023-03-24 19:19:19 -04:00
pata_it821x.c scsi: ata: Declare SCSI host templates const 2023-03-24 19:19:19 -04:00
pata_it8213.c scsi: ata: Declare SCSI host templates const 2023-03-24 19:19:19 -04:00
pata_ixp4xx_cf.c SCSI misc on 20230426 2023-04-26 15:39:25 -07:00
pata_jmicron.c scsi: ata: Declare SCSI host templates const 2023-03-24 19:19:19 -04:00
pata_legacy.c scsi: ata: Declare SCSI host templates const 2023-03-24 19:19:19 -04:00
pata_macio.c SCSI misc on 20230426 2023-04-26 15:39:25 -07:00
pata_marvell.c scsi: ata: Declare SCSI host templates const 2023-03-24 19:19:19 -04:00
pata_mpc52xx.c scsi: ata: Declare SCSI host templates const 2023-03-24 19:19:19 -04:00
pata_mpiix.c scsi: ata: Declare SCSI host templates const 2023-03-24 19:19:19 -04:00
pata_netcell.c scsi: ata: Declare SCSI host templates const 2023-03-24 19:19:19 -04:00
pata_ninja32.c scsi: ata: Declare SCSI host templates const 2023-03-24 19:19:19 -04:00
pata_ns87410.c scsi: ata: Declare SCSI host templates const 2023-03-24 19:19:19 -04:00
pata_ns87415.c scsi: ata: Declare SCSI host templates const 2023-03-24 19:19:19 -04:00
pata_octeon_cf.c scsi: ata: Declare SCSI host templates const 2023-03-24 19:19:19 -04:00
pata_of_platform.c scsi: ata: Declare SCSI host templates const 2023-03-24 19:19:19 -04:00
pata_oldpiix.c scsi: ata: Declare SCSI host templates const 2023-03-24 19:19:19 -04:00
pata_opti.c scsi: ata: Declare SCSI host templates const 2023-03-24 19:19:19 -04:00
pata_optidma.c scsi: ata: Declare SCSI host templates const 2023-03-24 19:19:19 -04:00
pata_pcmcia.c scsi: ata: Declare SCSI host templates const 2023-03-24 19:19:19 -04:00
pata_pdc202xx_old.c scsi: ata: Declare SCSI host templates const 2023-03-24 19:19:19 -04:00
pata_pdc2027x.c scsi: ata: Declare SCSI host templates const 2023-03-24 19:19:19 -04:00
pata_piccolo.c scsi: ata: Declare SCSI host templates const 2023-03-24 19:19:19 -04:00
pata_platform.c scsi: ata: Declare SCSI host templates const 2023-03-24 19:19:19 -04:00
pata_pxa.c scsi: ata: Declare SCSI host templates const 2023-03-24 19:19:19 -04:00
pata_radisys.c scsi: ata: Declare SCSI host templates const 2023-03-24 19:19:19 -04:00
pata_rb532_cf.c scsi: ata: Declare SCSI host templates const 2023-03-24 19:19:19 -04:00
pata_rdc.c scsi: ata: Declare SCSI host templates const 2023-03-24 19:19:19 -04:00
pata_rz1000.c scsi: ata: Declare SCSI host templates const 2023-03-24 19:19:19 -04:00
pata_sc1200.c scsi: ata: Declare SCSI host templates const 2023-03-24 19:19:19 -04:00
pata_sch.c scsi: ata: Declare SCSI host templates const 2023-03-24 19:19:19 -04:00
pata_serverworks.c scsi: ata: Declare SCSI host templates const 2023-03-24 19:19:19 -04:00
pata_sil680.c scsi: ata: Declare SCSI host templates const 2023-03-24 19:19:19 -04:00
pata_sis.c scsi: ata: Declare SCSI host templates const 2023-03-24 19:19:19 -04:00
pata_sl82c105.c scsi: ata: Declare SCSI host templates const 2023-03-24 19:19:19 -04:00
pata_triflex.c scsi: ata: Declare SCSI host templates const 2023-03-24 19:19:19 -04:00
pata_via.c scsi: ata: Declare SCSI host templates const 2023-03-24 19:19:19 -04:00
pdc_adma.c scsi: ata: Declare SCSI host templates const 2023-03-24 19:19:19 -04:00
sata_dwc_460ex.c SCSI misc on 20230426 2023-04-26 15:39:25 -07:00
sata_fsl.c scsi: ata: Declare SCSI host templates const 2023-03-24 19:19:19 -04:00
sata_gemini.c ata: sata_gemini: Remove dependency on OF for compile tests 2022-10-18 08:04:46 +09:00
sata_gemini.h
sata_highbank.c scsi: ata: Declare SCSI host templates const 2023-03-24 19:19:19 -04:00
sata_inic162x.c scsi: ata: Declare SCSI host templates const 2023-03-24 19:19:19 -04:00
sata_mv.c scsi: ata: Declare SCSI host templates const 2023-03-24 19:19:19 -04:00
sata_nv.c scsi: ata: Declare SCSI host templates const 2023-03-24 19:19:19 -04:00
sata_promise.c scsi: ata: Declare SCSI host templates const 2023-03-24 19:19:19 -04:00
sata_promise.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 18 2019-05-21 11:28:46 +02:00
sata_qstor.c scsi: ata: Declare SCSI host templates const 2023-03-24 19:19:19 -04:00
sata_rcar.c scsi: ata: Declare SCSI host templates const 2023-03-24 19:19:19 -04:00
sata_sil24.c scsi: ata: Declare SCSI host templates const 2023-03-24 19:19:19 -04:00
sata_sil.c scsi: ata: Declare SCSI host templates const 2023-03-24 19:19:19 -04:00
sata_sis.c scsi: ata: Declare SCSI host templates const 2023-03-24 19:19:19 -04:00
sata_svw.c scsi: ata: Declare SCSI host templates const 2023-03-24 19:19:19 -04:00
sata_sx4.c scsi: ata: Declare SCSI host templates const 2023-03-24 19:19:19 -04:00
sata_uli.c scsi: ata: Declare SCSI host templates const 2023-03-24 19:19:19 -04:00
sata_via.c scsi: ata: Declare SCSI host templates const 2023-03-24 19:19:19 -04:00
sata_vsc.c scsi: ata: Declare SCSI host templates const 2023-03-24 19:19:19 -04:00
sis.h