Commit 02a8ac4b authored by Patrick Mansfield's avatar Patrick Mansfield Committed by James Bottomley

[PATCH] 4/5 scsi-locking-2.5 list_del starved_entry plus use

list_del the starved_entry when sdev goes away.

Use GFP_ATOMIC when allocating starget, since we hold a lock.
parent 3f395dc4
...@@ -489,13 +489,14 @@ static void scsi_free_sdev(struct scsi_device *sdev) ...@@ -489,13 +489,14 @@ static void scsi_free_sdev(struct scsi_device *sdev)
sdev->host->hostt->slave_destroy(sdev); sdev->host->hostt->slave_destroy(sdev);
if (sdev->inquiry) if (sdev->inquiry)
kfree(sdev->inquiry); kfree(sdev->inquiry);
if (sdev->single_lun) {
spin_lock_irqsave(sdev->host->host_lock, flags); spin_lock_irqsave(sdev->host->host_lock, flags);
list_del(&sdev->starved_entry);
if (sdev->single_lun) {
sdev->sdev_target->starget_refcnt--; sdev->sdev_target->starget_refcnt--;
if (sdev->sdev_target->starget_refcnt == 0) if (sdev->sdev_target->starget_refcnt == 0)
kfree(sdev->sdev_target); kfree(sdev->sdev_target);
spin_unlock_irqrestore(sdev->host->host_lock, flags);
} }
spin_unlock_irqrestore(sdev->host->host_lock, flags);
kfree(sdev); kfree(sdev);
} }
...@@ -1275,7 +1276,7 @@ static int scsi_add_lun(Scsi_Device *sdev, Scsi_Request *sreq, ...@@ -1275,7 +1276,7 @@ static int scsi_add_lun(Scsi_Device *sdev, Scsi_Request *sreq,
} }
} }
if (!starget) { if (!starget) {
starget = kmalloc(sizeof(*starget), GFP_KERNEL); starget = kmalloc(sizeof(*starget), GFP_ATOMIC);
if (!starget) { if (!starget) {
printk(ALLOC_FAILURE_MSG, __FUNCTION__); printk(ALLOC_FAILURE_MSG, __FUNCTION__);
spin_unlock_irqrestore(sdev->host->host_lock, spin_unlock_irqrestore(sdev->host->host_lock,
......
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