Merge git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6: [SCSI] fix race in scsi_target_reap [SCSI] aacraid: Eliminate use after free [SCSI] arcmsr: Support HW reset for EH and polling scheme for scsi device [SCSI] bfa: fix system crash when reading sysfs fc_host statistics [SCSI] iscsi_tcp: remove sk_sleep check [SCSI] ipr: improve interrupt service routine performance [SCSI] ipr: set the data list length in the request control block [SCSI] ipr: fix a register read to use the correct address for 64 bit adapters [SCSI] ipr: include the resource path in the IOA status area structure [SCSI] ipr: implement fixes for 64 bit adapter support [SCSI] be2iscsi: correct return value in mgmt_invalidate_icds()
This commit is contained in:
@@ -492,19 +492,20 @@ void scsi_target_reap(struct scsi_target *starget)
|
||||
struct Scsi_Host *shost = dev_to_shost(starget->dev.parent);
|
||||
unsigned long flags;
|
||||
enum scsi_target_state state;
|
||||
int empty;
|
||||
int empty = 0;
|
||||
|
||||
spin_lock_irqsave(shost->host_lock, flags);
|
||||
state = starget->state;
|
||||
empty = --starget->reap_ref == 0 &&
|
||||
list_empty(&starget->devices) ? 1 : 0;
|
||||
if (--starget->reap_ref == 0 && list_empty(&starget->devices)) {
|
||||
empty = 1;
|
||||
starget->state = STARGET_DEL;
|
||||
}
|
||||
spin_unlock_irqrestore(shost->host_lock, flags);
|
||||
|
||||
if (!empty)
|
||||
return;
|
||||
|
||||
BUG_ON(state == STARGET_DEL);
|
||||
starget->state = STARGET_DEL;
|
||||
if (state == STARGET_CREATED)
|
||||
scsi_target_destroy(starget);
|
||||
else
|
||||
|
Reference in New Issue
Block a user