Commit a50a5e37 authored by Mike Anderson's avatar Mike Anderson Committed by James Bottomley

[SCSI] scsi: move target_destroy call

This patch moves the calling of target_destroy next to the list_del. This
closed a race being seen while doing a device add on the aic7xxx.
Signed-off-by: default avatarMike Anderson <andmike@us.ibm.com>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@SteelEye.com>
parent 9dec70e0
...@@ -288,10 +288,7 @@ static void scsi_target_dev_release(struct device *dev) ...@@ -288,10 +288,7 @@ static void scsi_target_dev_release(struct device *dev)
{ {
struct device *parent = dev->parent; struct device *parent = dev->parent;
struct scsi_target *starget = to_scsi_target(dev); struct scsi_target *starget = to_scsi_target(dev);
struct Scsi_Host *shost = dev_to_shost(parent);
if (shost->hostt->target_destroy)
shost->hostt->target_destroy(starget);
kfree(starget); kfree(starget);
put_device(parent); put_device(parent);
} }
...@@ -416,6 +413,8 @@ static void scsi_target_reap_usercontext(void *data) ...@@ -416,6 +413,8 @@ static void scsi_target_reap_usercontext(void *data)
device_del(&starget->dev); device_del(&starget->dev);
transport_destroy_device(&starget->dev); transport_destroy_device(&starget->dev);
spin_lock_irqsave(shost->host_lock, flags); spin_lock_irqsave(shost->host_lock, flags);
if (shost->hostt->target_destroy)
shost->hostt->target_destroy(starget);
list_del_init(&starget->siblings); list_del_init(&starget->siblings);
spin_unlock_irqrestore(shost->host_lock, flags); spin_unlock_irqrestore(shost->host_lock, flags);
put_device(&starget->dev); put_device(&starget->dev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment