aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/scsi_scan.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2010-05-27 13:28:11 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-05-27 13:28:11 -0400
commite2e2400bd4faee24d11872134b7ae5bd363749c0 (patch)
treea6e64a4d3b456835108f1620d46bfaef2e4da066 /drivers/scsi/scsi_scan.c
parente4ce30f3779c2ddaa7dfaa4042209e5dbacbada5 (diff)
parentf9e8894ae5157796dd69249c56062042d02a431d (diff)
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()
Diffstat (limited to 'drivers/scsi/scsi_scan.c')
-rw-r--r--drivers/scsi/scsi_scan.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
index 9798c2c06b93..1c027a97d8b9 100644
--- a/drivers/scsi/scsi_scan.c
+++ b/drivers/scsi/scsi_scan.c
@@ -492,19 +492,20 @@ void scsi_target_reap(struct scsi_target *starget)
492 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); 492 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent);
493 unsigned long flags; 493 unsigned long flags;
494 enum scsi_target_state state; 494 enum scsi_target_state state;
495 int empty; 495 int empty = 0;
496 496
497 spin_lock_irqsave(shost->host_lock, flags); 497 spin_lock_irqsave(shost->host_lock, flags);
498 state = starget->state; 498 state = starget->state;
499 empty = --starget->reap_ref == 0 && 499 if (--starget->reap_ref == 0 && list_empty(&starget->devices)) {
500 list_empty(&starget->devices) ? 1 : 0; 500 empty = 1;
501 starget->state = STARGET_DEL;
502 }
501 spin_unlock_irqrestore(shost->host_lock, flags); 503 spin_unlock_irqrestore(shost->host_lock, flags);
502 504
503 if (!empty) 505 if (!empty)
504 return; 506 return;
505 507
506 BUG_ON(state == STARGET_DEL); 508 BUG_ON(state == STARGET_DEL);
507 starget->state = STARGET_DEL;
508 if (state == STARGET_CREATED) 509 if (state == STARGET_CREATED)
509 scsi_target_destroy(starget); 510 scsi_target_destroy(starget);
510 else 511 else