Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 328925
b: refs/heads/master
c: bc3f02a
h: refs/heads/master
i:
  328923: ad9d056
v: v3
  • Loading branch information
Dan Williams authored and James Bottomley committed Sep 24, 2012
1 parent df3f337 commit a2ffc4c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 17 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 225c56960fcafeccc2b6304f96cd3f0dbf42a16a
refs/heads/master: bc3f02a795d3b4faa99d37390174be2a75d091bd
30 changes: 14 additions & 16 deletions trunk/drivers/scsi/scsi_sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -1031,33 +1031,31 @@ static void __scsi_remove_target(struct scsi_target *starget)
void scsi_remove_target(struct device *dev)
{
struct Scsi_Host *shost = dev_to_shost(dev->parent);
struct scsi_target *starget, *found;
struct scsi_target *starget, *last = NULL;
unsigned long flags;

restart:
found = NULL;
/* remove targets being careful to lookup next entry before
* deleting the last
*/
spin_lock_irqsave(shost->host_lock, flags);
list_for_each_entry(starget, &shost->__targets, siblings) {
if (starget->state == STARGET_DEL)
continue;
if (starget->dev.parent == dev || &starget->dev == dev) {
found = starget;
found->reap_ref++;
break;
/* assuming new targets arrive at the end */
starget->reap_ref++;
spin_unlock_irqrestore(shost->host_lock, flags);
if (last)
scsi_target_reap(last);
last = starget;
__scsi_remove_target(starget);
spin_lock_irqsave(shost->host_lock, flags);
}
}
spin_unlock_irqrestore(shost->host_lock, flags);

if (found) {
__scsi_remove_target(found);
scsi_target_reap(found);
/* in the case where @dev has multiple starget children,
* continue removing.
*
* FIXME: does such a case exist?
*/
goto restart;
}
if (last)
scsi_target_reap(last);
}
EXPORT_SYMBOL(scsi_remove_target);

Expand Down

0 comments on commit a2ffc4c

Please sign in to comment.