linux-kernel-test/drivers/scsi
Aaron Lu 10c580e423 [SCSI] sd: call blk_pm_runtime_init before add_disk
Sujit has found a race condition that would make q->nr_pending
unbalanced, it occurs as Sujit explained:

"
sd_probe_async() ->
	add_disk() ->
		disk_add_event() ->
			schedule(disk_events_workfn)
	sd_revalidate_disk()
	blk_pm_runtime_init()
return;

Let's say the disk_events_workfn() calls sd_check_events() which tries
to send test_unit_ready() and because of sd_revalidate_disk() trying to
send another commands the test_unit_ready() might be re-queued as the
tagged command queuing is disabled.

So the race condition is -

Thread 1 			  |		Thread 2
sd_revalidate_disk()		  |	sd_check_events()
...nr_pending = 0 as q->dev = NULL|	scsi_queue_insert()
blk_runtime_pm_init()		  | 	blk_pm_requeue_request() ->
				  |	nr_pending = -1 since
				  |	q->dev != NULL
"

The problem is, the test_unit_ready request doesn't get counted the
first time it is queued, so the later decrement of q->nr_pending in
blk_pm_requeue_request makes it unbalanced.

Fix this by calling blk_pm_runtime_init before add_disk so that all
requests initiated there will all be counted.

Signed-off-by: Aaron Lu <aaron.lu@intel.com>
Reported-and-tested-by: Sujit Reddy Thumma <sthumma@codeaurora.org>
Cc: stable@vger.kernel.org
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2013-10-23 14:09:18 +01:00
..
aacraid SCSI misc on 20130702 2013-07-04 12:30:30 -07:00
aic7xxx [SCSI] aic7xxx: fix swapped arguments in ahc_find_pci_device 2013-09-10 14:48:16 -07:00
aic7xxx_old scsi: Spelling hsot -> host 2013-05-28 12:02:12 +02:00
aic94xx [SCSI] libsas: implement > 16 byte CDB support 2013-06-04 11:15:59 -07:00
arcmsr
arm acornscsi: switch to ->show_info() 2013-04-09 14:13:27 -04:00
be2iscsi drivers: avoid format strings in names passed to alloc_workqueue() 2013-07-03 16:07:41 -07:00
bfa Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial 2013-09-06 09:36:28 -07:00
bnx2fc bnx2x, cnic, bnx2i, bnx2fc: Fix bnx2i and bnx2fc regressions. 2013-09-18 12:24:32 -04:00
bnx2i bnx2x, cnic, bnx2i, bnx2fc: Fix bnx2i and bnx2fc regressions. 2013-09-18 12:24:32 -04:00
csiostor [SCSI] csiostor: Retain default adapter configuration in absence of config file. 2013-06-04 11:16:28 -07:00
cxgbi treewide: Add __GFP_NOWARN to k.alloc calls with v.alloc fallbacks 2013-08-20 13:06:40 +02:00
device_handler [SCSI] scsi_dh_alua: Add module parameter to allow failover to non preferred path without STPG 2013-04-11 16:00:31 -07:00
dpt
esas2r [SCSI] esas2r: Remove null test for stack allocated fw_coredump_buffer 2013-09-06 11:22:35 -07:00
fcoe SCSI for-linus on 20130713 2013-07-13 17:41:21 -07:00
fnic [SCSI] fnic: fnic Driver Tuneables Exposed through CLI 2013-09-11 15:59:25 -07:00
ibmvscsi [SCSI] ibmvfc: Fix for offlining devices during error recovery 2013-09-06 11:41:34 -07:00
isci [SCSI] isci: Fix a infinite loop. 2013-08-26 12:51:30 +04:00
libfc A short series of fixes to libfc, libfcoe and fcoe. 2013-07-13 08:22:56 +04:00
libsas [SCSI] libsas: implement > 16 byte CDB support 2013-06-04 11:15:59 -07:00
lpfc SCSI misc on 20130915 2013-09-15 17:41:30 -04:00
megaraid SCSI misc on 20130915 2013-09-15 17:41:30 -04:00
mpt2sas [SCSI] mpt2sas: Remove phys on topology change. 2013-09-03 07:27:58 -07:00
mpt3sas [SCSI] Allow MPT Fusion SAS 3.0 driver to be built into the kernel 2013-09-06 11:42:53 -07:00
mvsas [SCSI] mvsas: Fix kernel panic on tile due to unaligned data access 2013-07-23 15:23:08 -07:00
osd SCSI: OSD: convert class code to use dev_groups 2013-07-25 16:34:39 -07:00
pcmcia
pm8001 SCSI misc on 20130903 2013-09-03 15:48:06 -07:00
qla2xxx [SCSI] qla2xxx: Fix request queue null dereference. 2013-10-23 14:09:18 +01:00
qla4xxx [SCSI] qla4xxx: Update driver version to 5.04.00-k1 2013-09-03 07:27:57 -07:00
sym53c8xx_2
ufs [SCSI] ufs: configure the attribute for power mode 2013-09-06 16:08:37 -07:00
.gitignore
3w-9xxx.c
3w-9xxx.h
3w-sas.c
3w-sas.h
3w-xxxx.c [SCSI] 3w-xxxx: Create sense buffer for unsupported commands 2013-06-24 16:32:22 -07:00
3w-xxxx.h
53c700_d.h_shipped
53c700.c
53c700.h
53c700.scr
a100u2w.c
a100u2w.h
a2091.c
a2091.h
a3000.c [SCSI] a3000: use module_platform_driver_probe() 2013-06-24 19:44:18 +02:00
a3000.h
a4000t.c [SCSI] a4000t: use module_platform_driver_probe() 2013-06-24 19:44:18 +02:00
advansys.c
aha152x.c aha152x: switch to ->show_info() 2013-04-09 14:13:22 -04:00
aha152x.h
aha1542.c
aha1542.h
aha1740.c aha1740: switch to ->show_info() 2013-04-09 14:13:23 -04:00
aha1740.h
aic7xxx_old.c aix7xxx_old: switch to ->show_info() 2013-04-09 14:13:28 -04:00
atari_NCR5380.c atari_scsi: switch to ->show_info() 2013-04-09 14:13:29 -04:00
atari_scsi.c atari_scsi: switch to ->show_info() 2013-04-09 14:13:29 -04:00
atari_scsi.h atari_scsi: switch to ->show_info() 2013-04-09 14:13:29 -04:00
atp870u.c atp870u: switch to ->show_info() 2013-04-09 14:13:24 -04:00
atp870u.h
BusLogic.c [SCSI] BusLogic: Fix an oops when intializing multimaster adapter 2013-10-16 13:57:14 +01:00
BusLogic.h [SCSI] BusLogic: Port driver to 64-bit. 2013-06-26 18:32:47 -07:00
bvme6000_scsi.c
ch.c
constants.c [SCSI] scsi constants: command, sense key + additional sense strings 2013-07-09 22:52:29 +01:00
dc395x.c dc395x: switch to ->show_info() 2013-04-09 14:13:24 -04:00
dc395x.h
dmx3191d.c
dpt_i2o.c dpt_i2o: switch to ->show_info() 2013-04-09 14:13:24 -04:00
dpti.h
dtc.c
dtc.h
eata_generic.h
eata_pio.c [SCSI] eata_pio: off by one in eata_pio_detect() 2013-09-03 07:27:58 -07:00
eata_pio.h
eata.c
esp_scsi.c esp_scsi: Fix tag state corruption when autosensing. 2013-08-01 18:08:34 -07:00
esp_scsi.h esp_scsi: Fix tag state corruption when autosensing. 2013-08-01 18:08:34 -07:00
fdomain.c
fdomain.h
FlashPoint.c [SCSI] BusLogic: Port driver to 64-bit. 2013-06-26 18:32:47 -07:00
g_NCR5380_mmio.c
g_NCR5380.c
g_NCR5380.h
gdth_ioctl.h
gdth_proc.c
gdth_proc.h
gdth.c
gdth.h
gvp11.c
gvp11.h
hosts.c
hpsa_cmd.h
hpsa.c SCSI misc on 20130915 2013-09-15 17:41:30 -04:00
hpsa.h [SCSI] hpsa: remove unneeded variable 2013-08-26 12:51:31 +04:00
hptiop.c
hptiop.h
imm.c
imm.h
in2000.c in2000: switch to ->show_info() 2013-04-09 14:13:25 -04:00
in2000.h
initio.c
initio.h
ipr.c [SCSI] ipr: Add sereral new CCIN definitions for new adapters support 2013-08-26 12:51:32 +04:00
ipr.h [SCSI] ipr: Add sereral new CCIN definitions for new adapters support 2013-08-26 12:51:32 +04:00
ips.c ips: fix format bugs exposed by previous commit 2013-04-09 14:13:27 -04:00
ips.h ips: switch to ->show_info() 2013-04-09 14:13:27 -04:00
iscsi_boot_sysfs.c
iscsi_tcp.c [SCSI] iscsi_tcp: support PF_MEMALLOC/__GFP_MEMALLOC 2013-04-11 16:55:04 -07:00
iscsi_tcp.h
jazz_esp.c
Kconfig SCSI misc on 20130903 2013-09-03 15:48:06 -07:00
lasi700.c
libiscsi_tcp.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next 2013-07-09 18:24:39 -07:00
libiscsi.c [SCSI] IB/iser: Add Discovery support 2013-08-26 18:53:49 +04:00
libsrp.c
mac53c94.c
mac53c94.h
mac_esp.c
mac_scsi.c
mac_scsi.h
Makefile [SCSI] esas2r: ATTO Technology ExpressSAS 6G SAS/SATA RAID Adapter Driver 2013-09-03 07:27:58 -07:00
megaraid.c PCI: Convert alloc_pci_dev(void) to pci_alloc_dev(bus) 2013-06-05 13:49:36 -06:00
megaraid.h megaraid: Don't use create_proc_read_entry() 2013-04-29 15:41:57 -04:00
mesh.c
mesh.h
mvme16x_scsi.c
mvme147.c
mvme147.h
mvumi.c [SCSI] mvumi: Use PCI_VENDOR_ID_MARVELL_EXT for 0x1b4b 2013-04-15 14:30:44 -06:00
mvumi.h [SCSI] mvumi: Use PCI_VENDOR_ID_MARVELL_EXT for 0x1b4b 2013-04-15 14:30:44 -06:00
ncr53c8xx.c
ncr53c8xx.h
NCR53c406a.c
NCR5380.c
NCR5380.h
NCR_D700.c
NCR_D700.h
NCR_Q720.c
NCR_Q720.h
nsp32_debug.c
nsp32_io.h
nsp32.c [SCSI] nsp32: use mdelay instead of large udelay constants 2013-06-19 17:53:35 +02:00
nsp32.h
osst_detect.h
osst_options.h
osst.c
osst.h
pas16.c
pas16.h
pmcraid.c treewide: Fix typo in printk 2013-06-18 13:48:45 +02:00
pmcraid.h
ppa.c
ppa.h
ps3rom.c
qla1280.c
qla1280.h
qlogicfas408.c
qlogicfas408.h
qlogicfas.c
qlogicpti.c
qlogicpti.h
raid_class.c
script_asm.pl
scsi_debug.c [SCSI] scsi_debug: fix logical block provisioning support when unmap_alignment != 0 2013-09-03 07:28:08 -07:00
scsi_devinfo.c [SCSI] Workaround for disks that report bad optimal transfer length 2013-06-24 13:00:10 -07:00
scsi_error.c [SCSI] Generate uevents on certain unit attention codes 2013-08-26 18:52:27 +04:00
scsi_ioctl.c
scsi_lib_dma.c
scsi_lib.c Merge branch 'for-3.12' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/libata 2013-09-03 18:19:53 -07:00
scsi_logging.h
scsi_module.c
scsi_netlink.c
scsi_pm.c PM / Runtime: Rework the "runtime idle" helper routine 2013-06-03 21:49:52 +02:00
scsi_priv.h
scsi_proc.c fix buffer leak after "scsi: saner replacements for ->proc_info()" 2013-05-31 15:16:51 -04:00
scsi_sas_internal.h
scsi_scan.c [SCSI] Workaround for disks that report bad optimal transfer length 2013-06-24 13:00:10 -07:00
scsi_sysctl.c
scsi_sysfs.c [SCSI] Generate uevents on certain unit attention codes 2013-08-26 18:52:27 +04:00
scsi_tgt_if.c
scsi_tgt_lib.c
scsi_tgt_priv.h
scsi_trace.c
scsi_transport_api.h
scsi_transport_fc_internal.h
scsi_transport_fc.c drivers: avoid format strings in names passed to alloc_workqueue() 2013-07-03 16:07:41 -07:00
scsi_transport_iscsi.c [SCSI] scsi_transport_iscsi: Exporting new attrs for iscsi session and connection in sysfs 2013-08-23 13:08:30 -04:00
scsi_transport_sas.c
scsi_transport_spi.c
scsi_transport_srp_internal.h
scsi_transport_srp.c
scsi_typedefs.h
scsi.c [SCSI] Don't attempt to send extended INQUIRY command if skip_vpd_pages is set 2013-08-02 13:20:21 -07:00
scsi.h
scsicam.c
sd_dif.c [SCSI] sd_dif: problem with verify of type 1 protection information (PI) 2013-05-02 15:37:03 -07:00
sd.c [SCSI] sd: call blk_pm_runtime_init before add_disk 2013-10-23 14:09:18 +01:00
sd.h [SCSI] sd: Update WRITE SAME heuristics 2013-06-26 17:56:18 -07:00
ses.c
sg.c [SCSI] sg: push file descriptor list locking down to per-device locking 2013-09-03 07:28:10 -07:00
sgiwd93.c
sim710.c
sni_53c710.c
sr_ioctl.c
sr_vendor.c
sr.c block_device_operations->release() should return void 2013-05-07 02:16:21 -04:00
sr.h
st_options.h
st.c [SCSI] st: convert class code to use dev_groups 2013-08-21 10:10:50 -07:00
st.h
stex.c
storvsc_drv.c Drivers: hv: remove HV_DRV_VERSION 2013-08-02 11:34:30 +08:00
sun3_NCR5380.c sun3_scsi: add ->show_info() 2013-05-04 14:50:16 -04:00
sun3_scsi_vme.c
sun3_scsi.c sun3_scsi: add ->show_info() 2013-05-04 14:50:16 -04:00
sun3_scsi.h sun3_scsi: add ->show_info() 2013-05-04 14:50:16 -04:00
sun3x_esp.c
sun_esp.c
sym53c416.c
sym53c416.h
t128.c
t128.h
tmscsim.c
tmscsim.h
u14-34f.c
ultrastor.c
ultrastor.h
virtio_scsi.c virtio-scsi: Fix virtqueue affinity setup 2013-08-01 11:37:19 +09:30
vmw_pvscsi.c
vmw_pvscsi.h
wd33c93.c
wd33c93.h
wd7000.c
zalon.c
zorro7xx.c