linux/drivers
Martin Peschke 86e8dfc560 [SCSI] zfcp: fix cleanup of dismissed error recovery actions
Calling zfcp_erp_strategy_check_action() after zfcp_erp_action_to_running()
in zfcp_erp_strategy() might cause an unbalanced up() for erp_ready_sem,
which makes the zfcp recovery fail somewhere along the way:

erp thread processing erp_action:
|
|	someone waking up erp thread for erp_action
|	|
|	|		someone else dismissing erp_action:
|	|		|
V	V		V

	write_lock_irqsave(&adapter->erp_lock, flags);
	...
	if (zfcp_erp_action_exists(erp_action) == ZFCP_ERP_ACTION_RUNNING) {
		zfcp_erp_action_to_ready(erp_action);
		up(&adapter->erp_ready_sem);	/* first up() for erp_action */
	}
	write_unlock_irqrestore(&adapter->erp_lock, flags);

write_lock_irqsave(&adapter->erp_lock, flags);
...
zfcp_erp_action_to_running(erp_action);
write_unlock_restore(&adapter->erp_lock, flags);
/* processing erp_action */

			write_lock_irqsave(&adapter->erp_lock, flags);
			...
			erp_action->status |= ZFCP_STATUS_ERP_DISMISSED;
			if (zfcp_erp_action_exists(erp_action) ==
						ZFCP_ERP_ACTION_RUNNING) {
				zfcp_erp_action_to_ready(erp_action);
				up(&adapter->erp_ready_sem);
				/* second, unbalanced up() for erp_action */
			}
			...
			write_unlock_restore(&adapter->erp_lock, flags);

write_lock_irqsave(&adapter->erp_lock, flags);
if (erp_action->status & ZFCP_STATUS_ERP_DISMISSED) {
	zfcp_erp_action_dequeue(erp_action);
	retval = ZFCP_ERP_DISMISSED;
}
...
write_unlock_restore(&adapter->erp_lock, flags);
down(&adapter->erp_ready_sem);
/* this down() is meant to balance the first up() */

The erp thread must not dismiss an erp_action after moving that action to
erp_running_head. Instead it should just go through the down() operation,
which balances the first up(), and run through zfcp_erp_strategy one more
time for the second up(), which eventually cleans up erp_action. Which
is similar to the normal processing of an event for erp_action doing
something asynchronously (e.g. waiting for the completion of an fsf_req).

This only works if we make sure that a dismissed erp_action is passed to
zfcp_erp_strategy() prior to the other action, which caused actions to be
dismissed. Therefore the patch implements this rule: running actions go to
the head of the ready list; new actions go to the tail of the ready list;
the erp thread picks actions to be processed from the ready list's head.

Signed-off-by: Martin Peschke <mp3@de.ibm.com>
Acked-by: Swen Schillig <swen@vnet.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
2007-11-16 13:03:21 -06:00
..
acorn/char unicode diacritics support 2007-10-17 08:42:52 -07:00
acpi Pull documentation into release branch 2007-10-29 17:31:01 -04:00
amba Driver core: change add_uevent_var to use a struct 2007-10-12 14:51:01 -07:00
ata ata_piix: Add additional PCI identifier for 40 wire short cable 2007-11-05 15:12:33 -08:00
atm Eliminate pointless casts from void* in a few driver irq handlers. 2007-10-23 19:53:16 -04:00
auxdisplay
base cleanup asm/scatterlist.h includes 2007-11-02 08:47:06 +01:00
block paride: fix 'and' typo in drivers/block/paride/pt.c 2007-11-05 15:12:32 -08:00
bluetooth [Bluetooth] Add generic driver for Bluetooth USB devices 2007-10-22 02:59:46 -07:00
cdrom SG: audit of drivers that use blk_rq_map_sg() 2007-10-24 13:21:21 +02:00
char drm: DRM: fix memset size error 2007-11-06 10:12:44 +10:00
clocksource
connector [CONNECTOR]: Fix a spurious kfree_skb() call 2007-10-30 21:29:47 -07:00
cpufreq Merge master.kernel.org:/pub/scm/linux/kernel/git/gregkh/driver-2.6 2007-10-12 15:49:37 -07:00
cpuidle cpuidle: remove unused exports 2007-10-29 17:27:50 -04:00
crypto [CRYPTO] users: Fix up scatterlist conversion errors 2007-10-27 00:52:07 -07:00
dca I/OAT: Add DCA services 2007-10-16 09:43:09 -07:00
dio
dma Remove bogus default y for DMAR and NET_DMA 2007-10-30 08:06:55 -07:00
edac NULL terminate the pci_device_ids in pasemi_edac 2007-10-19 11:53:56 -07:00
eisa signedness: module_param_array nump argument 2007-10-14 12:41:52 -07:00
firewire firewire: Fix pci resume to not pass in a __be32 config rom. 2007-10-31 19:02:19 +01:00
firmware define global BIT macro 2007-10-19 11:53:42 -07:00
hid HID: Don't access input_dev->private directly 2007-10-31 13:30:35 +01:00
hwmon Merge git://git.kernel.org/pub/scm/linux/kernel/git/bunk/trivial 2007-10-19 20:36:17 -07:00
i2c typo fixes 2007-10-20 01:34:40 +02:00
ide ide: fix IDE_HFLAG_NO_ATAPI_DMA handling in config_drive_for_dma() 2007-11-05 21:42:30 +01:00
ieee1394 ieee1394: iso and async streams: s/g list fix 2007-11-04 14:31:16 +01:00
infiniband Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/roland/infiniband 2007-10-30 15:26:56 -07:00
input Use i8253.c lock for PC speaker on MIPS, too. 2007-11-02 19:39:18 -07:00
isdn i4l: errors with assignments in if 2007-11-05 15:12:31 -08:00
kvm Consolidate host virtualization support under Virtualization menu 2007-10-23 15:49:47 +10:00
leds leds: bugfixes for leds-gpio 2007-11-05 21:54:41 +00:00
lguest lguest: documentation update 2007-10-25 15:02:50 +10:00
macintosh Merge git://git.kernel.org/pub/scm/linux/kernel/git/bunk/trivial 2007-10-19 20:36:17 -07:00
mca
md md: fix misapplied patch in raid5.c 2007-11-05 15:12:32 -08:00
media V4L/DVB (6548): pvrusb2: Fix oops on module removal 2007-11-04 21:41:30 -02:00
message i2o: debug messages corrected 2007-11-05 15:12:31 -08:00
mfd typo fixes 2007-10-20 01:34:40 +02:00
misc fujitsu-laptop.c: remove dead code 2007-10-25 17:43:46 -04:00
mmc cleanup asm/scatterlist.h includes 2007-11-02 08:47:06 +01:00
mtd Eliminate pointless casts from void* in a few driver irq handlers. 2007-10-23 19:53:16 -04:00
net Merge branch 'upstream-linus' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/netdev-2.6 2007-11-05 17:42:41 -08:00
nubus
of [SPARC/64]: Consolidate of_register_driver 2007-10-17 21:17:42 -07:00
oprofile
parisc parisc: fix sg_page() fallout 2007-10-23 09:49:31 +02:00
parport [PARPORT] Remove unused 'irq' argument from parport irq functions 2007-10-23 19:53:16 -04:00
pci PCI: Add Kconfig option to disable deprecated pci_find_* API 2007-11-05 13:35:17 -08:00
pcmcia remove asm/bitops.h includes 2007-10-19 11:53:41 -07:00
pnp PNP: add debug message for adding new device 2007-10-17 08:43:04 -07:00
power Merge git://git.infradead.org/battery-2.6 2007-10-22 19:20:52 -07:00
ps3 remove asm/bitops.h includes 2007-10-19 11:53:41 -07:00
rapidio
rtc rtc: m48t59 fix section mismatch warning 2007-11-05 15:12:32 -08:00
s390 [SCSI] zfcp: fix cleanup of dismissed error recovery actions 2007-11-16 13:03:21 -06:00
sbus vfc_dev conversion to mutex: fallout 2007-10-20 15:04:06 -07:00
scsi [SCSI] qla1280: convert to use the data buffer accessors 2007-11-14 18:25:44 -06:00
serial serial: fix compile warning about putc 2007-11-05 15:12:32 -08:00
sh maple: Fix maple bus compiler warning 2007-10-30 09:56:40 +09:00
sn
spi fix abuses of ptrdiff_t 2007-10-29 07:41:33 -07:00
ssb [PATCH] ssb: fix build failure 2007-10-16 21:04:11 -04:00
tc lk201: remove obsolete driver 2007-10-17 08:42:57 -07:00
telephony telephony: phonedev panics if unregistering device not registered [Bug 9266] 2007-11-05 15:12:33 -08:00
uio
usb cleanup asm/scatterlist.h includes 2007-11-02 08:47:06 +01:00
video Kbuild/doc: fix links to Documentation files 2007-10-30 14:26:30 -07:00
virtio Virtio helper routines for a descriptor ringbuffer implementation 2007-10-23 15:49:55 +10:00
w1 Kbuild/doc: fix links to Documentation files 2007-10-30 14:26:30 -07:00
watchdog Merge git://git.kernel.org/pub/scm/linux/kernel/git/wim/linux-2.6-watchdog 2007-11-02 19:36:26 -07:00
xen Add missing newlines to some uses of dev_<level> messages 2007-10-18 14:37:28 -07:00
zorro Convert files to UTF-8 and some cleanups 2007-10-19 23:21:04 +02:00
Kconfig Virtio interface 2007-10-23 15:49:54 +10:00
Makefile Merge master.kernel.org:/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6 2007-10-23 16:37:29 -07:00