Commit 7d2370c1 authored by James Bottomley's avatar James Bottomley

SCSI: fix Stack overflow when lldd returns SCSI_MLQUEUE_DEVICE_BUSY

From: 	Heiko Carstens <Heiko.Carstens@de.ibm.com>

This happened when sending out the inquiry command and the LLDD was in
recovery for the specific LUN and returned SCSI_MLQUEUE_DEVICE_BUSY.
Problem is that max_device_blocked gets set _after_ the inquiry command
finished. In this specific case max_device_blocked was 0 and thus the
device was never blocked resulting in the observed stack overflow.
I moved the initializazion of max_device_blocked from scsi_add_lun to
sdev_alloc_sdev and the problem is gone.
parent 545907e6
......@@ -212,6 +212,11 @@ static struct scsi_device *scsi_alloc_sdev(struct Scsi_Host *shost,
INIT_LIST_HEAD(&sdev->starved_entry);
spin_lock_init(&sdev->list_lock);
/* if the device needs this changing, it may do so in the
* slave_configure function */
sdev->max_device_blocked = SCSI_DEFAULT_DEVICE_BLOCKED;
/*
* Some low level driver could use device->type
*/
......@@ -628,10 +633,6 @@ static int scsi_add_lun(struct scsi_device *sdev, char *inq_result, int *bflags)
spin_unlock_irqrestore(sdev->host->host_lock, flags);
}
/* if the device needs this changing, it may do so in the detect
* function */
sdev->max_device_blocked = SCSI_DEFAULT_DEVICE_BLOCKED;
sdev->use_10_for_rw = 1;
if (*bflags & BLIST_MS_SKIP_PAGE_08)
......
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