Commit 70e528ed authored by James Bottomley's avatar James Bottomley Committed by James Bottomley

[PATCH] make the SCSI mid-layer obey the device online flag

It has been pointed out by the USB people that the mid-layer doesn't
obey its own online flag.

The attached patch should fix this.  However, there are a few caveats to
offlining (read that as devices should still be prepared to process
commands).

1. Any special command will still be accepted (that's a command either
via the SCSI_IOCTL_SEND_COMMAND, or an internally generated command).
2. Outstanding already processed commands in the queue (i.e. commands
which have already been through the upper layer drivers but needed
requeuing for some reason like QUEUE_FULL or device busy).

I'm willing to consider changing 2., it just requires more speciallised
logic to distinguish between a command that has been prepared by the
upper level drivers and a command sent via 1.

However, not that LLDs may not assume they will receive no commands just
because scsi_device->online is zero.
parent e59aa73e
......@@ -944,6 +944,18 @@ static int scsi_prep_fn(struct request_queue *q, struct request *req)
} else
cmd = req->special;
} else if (req->flags & (REQ_CMD | REQ_BLOCK_PC)) {
/*
* Just check to see if the device is online. If
* it isn't, we refuse to process ordinary commands
* (we will allow specials just in case someone needs
* to send a command to an offline device without bringing
* it back online)
*/
if(!sdev->online) {
printk(KERN_ERR "scsi%d (%d:%d): rejecting I/O to offline device\n",
sdev->host->host_no, sdev->id, sdev->lun);
return BLKPREP_KILL;
}
/*
* Now try and find a command block that we can use.
*/
......
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