kernel-aes67/drivers/ieee1394
Stefan Richter 24c7cd0630 [PATCH] sbp2: fix spinlock recursion
sbp2util_mark_command_completed takes a lock which was already taken by
sbp2scsi_complete_all_commands.  This is a regression in Linux 2.6.15.

 Reported by Kristian Harms at
	https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=187394

[ More complete commentary, as response to questions by Andrew: ]

> This changes the call environment for all implementations of
> ->Current_done().  Are they all safe to call under this lock?

Short answer: Yes, trust me.  ;-) Long answer:

The done() callbacks are passed on to sbp2 from the SCSI stack along
with each SCSI command via the queuecommand hook.  The done() callback
is safe to call in atomic context.  So does
Documentation/scsi/scsi_mid_low_api.txt say, and many if not all SCSI
low-level handlers rely on this fact.  So whatever this callback does,
it is "self-contained" and it won't conflict with sbp2's internal ORB
list handling.  In particular, it won't race with the
sbp2_command_orb_lock.

Moreover, sbp2 already calls the done() handler with
sbp2_command_orb_lock taken in sbp2scsi_complete_all_commands().  I
admit this is ultimately no proof of correctness, especially since this
portion of code introduced the spinlock recursion in the first place and
we didn't realize it since this code's submission before 2.6.15 until
now.  (I have learned a lesson from this.)

I stress-tested my patch on x86 uniprocessor with a preemptible SMP
kernel (alas I have no SMP machine yet) and made sure that all code
paths which involve the sbp2_command_orb_lock were gone through multiple
times.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-04-02 12:58:09 -07:00
..
.gitignore gitignore: misc files 2006-01-01 22:21:50 +01:00
config_roms.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
config_roms.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
csr1212.c csr1212: add check for !valid 2005-11-22 12:17:14 -05:00
csr1212.h kmalloc/kzalloc changes: 2005-11-07 06:31:45 -05:00
csr.c [PATCH] Sync up ieee-1394 2005-07-10 12:23:23 -07:00
csr.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
dma.c ieee1394/dma: LIndent fixes 2005-11-22 12:18:28 -05:00
dma.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
dv1394-private.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
dv1394.c ieee1394: remove devfs support 2006-03-28 19:55:41 -05:00
dv1394.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
eth1394.c kmalloc/kzalloc changes: 2005-11-07 06:31:45 -05:00
eth1394.h [PATCH] eth1394: workaround limitation in rawiso routines 2005-09-30 12:41:19 -07:00
highlevel.c [PATCH] bitops: hweight() related cleanup 2006-03-26 08:57:15 -08:00
highlevel.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
hosts.c ieee1394: whitespace cleanup in hosts.[ch], ieee1394_core.[ch] 2005-12-01 18:52:03 -05:00
hosts.h ieee1394: resume remote ports when starting a host (fixes device recognition) 2005-12-12 23:20:58 -05:00
ieee1394_core.c ieee1394: set read permission for parameter disable_irm 2006-03-28 20:03:34 -05:00
ieee1394_core.h ieee1394: remove amdtp remains from ieee1394_core.h 2006-03-28 19:56:45 -05:00
ieee1394_hotplug.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ieee1394_transactions.c ieee1394/ieee1394_transactions: LIndent fixes 2005-11-22 12:34:16 -05:00
ieee1394_transactions.h [PATCH] ieee1394: drivers/ieee1394/ieee1394_transactions.c: possible cleanups 2005-05-17 07:59:22 -07:00
ieee1394_types.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ieee1394-ioctl.h Remove amdtp, cmp drivers. 2005-11-18 00:16:26 -05:00
ieee1394.h ieee1394: add definitions for phy packet constants 2005-12-01 18:51:56 -05:00
iso.c ieee1394/iso: LIndent fixes 2005-11-22 12:35:23 -05:00
iso.h [PATCH] Sync up ieee-1394 2005-07-10 12:23:23 -07:00
Kconfig Remove amdtp, cmp drivers. 2005-11-18 00:16:26 -05:00
Makefile Remove amdtp, cmp drivers. 2005-11-18 00:16:26 -05:00
nodemgr.c Merge with http://kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git 2006-01-05 08:03:40 -05:00
nodemgr.h ieee1394: remove nonexistent functions from nodemgr.h 2005-12-05 16:29:02 -05:00
ohci1394.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc 2006-03-29 11:28:30 -08:00
ohci1394.h Remove amdtp, cmp drivers. 2005-11-18 00:16:26 -05:00
oui2c.sh Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
oui.db Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
pcilynx.c kmalloc/kzalloc changes: 2005-11-07 06:31:45 -05:00
pcilynx.h [PATCH] ieee1394: drivers/ieee1394/pcilynx.c: remove dead options 2005-05-17 07:59:22 -07:00
raw1394-private.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
raw1394.c ieee1394: remove devfs support 2006-03-28 19:55:41 -05:00
raw1394.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
sbp2.c [PATCH] sbp2: fix spinlock recursion 2006-04-02 12:58:09 -07:00
sbp2.h sbp2: variable status FIFO address (fix login timeout) 2006-02-23 00:28:52 -05:00
video1394.c ieee1394: remove devfs support 2006-03-28 19:55:41 -05:00
video1394.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00