kernel-fxtec-pro1x/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
config_roms.c
config_roms.h
csr.c
csr.h
csr1212.c
csr1212.h
dma.c
dma.h
dv1394-private.h
dv1394.c ieee1394: remove devfs support 2006-03-28 19:55:41 -05:00
dv1394.h
eth1394.c
eth1394.h
highlevel.c
highlevel.h
hosts.c
hosts.h
ieee1394-ioctl.h
ieee1394.h
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
ieee1394_transactions.c
ieee1394_transactions.h
ieee1394_types.h
iso.c
iso.h
Kconfig
Makefile
nodemgr.c
nodemgr.h
ohci1394.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc 2006-03-29 11:28:30 -08:00
ohci1394.h
oui.db
oui2c.sh
pcilynx.c
pcilynx.h
raw1394-private.h
raw1394.c ieee1394: remove devfs support 2006-03-28 19:55:41 -05:00
raw1394.h
sbp2.c [PATCH] sbp2: fix spinlock recursion 2006-04-02 12:58:09 -07:00
sbp2.h
video1394.c ieee1394: remove devfs support 2006-03-28 19:55:41 -05:00
video1394.h