Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[SCSI] Remove unnecessary locking around completion function calls

The SCSI ->done() hook should not be called from inside a spinlock.

Drivers that do this are mostly cut-n-paste from 2.2.x-era.

Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>

-12
-4
drivers/fc4/fc.c
··· 767 767 { 768 768 unsigned long flags; 769 769 770 - spin_lock_irqsave(SCpnt->device->host->host_lock, flags); 771 770 if (FCP_CMND(SCpnt)->done) 772 771 FCP_CMND(SCpnt)->done(SCpnt); 773 - spin_unlock_irqrestore(SCpnt->device->host->host_lock, flags); 774 772 } 775 773 776 774 static int fcp_scsi_queue_it(fc_channel *fc, Scsi_Cmnd *SCpnt, fcp_cmnd *fcmd, int prepare) ··· 910 912 unsigned long flags; 911 913 912 914 SCpnt->result = DID_ABORT; 913 - spin_lock_irqsave(SCpnt->device->host->host_lock, flags); 914 915 fcmd->done(SCpnt); 915 - spin_unlock_irqrestore(SCpnt->device->host->host_lock, flags); 916 916 printk("FC: soft abort\n"); 917 917 return SUCCESS; 918 918 } else {
-6
drivers/ieee1394/sbp2.c
··· 2453 2453 u32 scsi_status, struct scsi_cmnd *SCpnt, 2454 2454 void (*done)(struct scsi_cmnd *)) 2455 2455 { 2456 - unsigned long flags; 2457 - 2458 2456 SBP2_DEBUG("sbp2scsi_complete_command"); 2459 2457 2460 2458 /* ··· 2551 2553 /* 2552 2554 * Tell scsi stack that we're done with this command 2553 2555 */ 2554 - spin_lock_irqsave(scsi_id->scsi_host->host_lock,flags); 2555 2556 done (SCpnt); 2556 - spin_unlock_irqrestore(scsi_id->scsi_host->host_lock,flags); 2557 - 2558 - return; 2559 2557 } 2560 2558 2561 2559
-2
drivers/scsi/ultrastor.c
··· 954 954 SCpnt->result = DID_ABORT << 16; 955 955 956 956 /* Take the host lock to guard against scsi layer re-entry */ 957 - spin_lock_irqsave(host->host_lock, flags); 958 957 done(SCpnt); 959 - spin_unlock_irqrestore(host->host_lock, flags); 960 958 961 959 /* Need to set a timeout here in case command never completes. */ 962 960 return SUCCESS;