On Mon, 2012-06-25 at 14:21 -0700, Tejun Heo wrote: > Hey, James. > > On Mon, Jun 25, 2012 at 10:14:49PM +0100, James Bottomley wrote: > > > @@ -1490,11 +1489,7 @@ static void scsi_request_fn(struct request_queue *q) > > > struct scsi_cmnd *cmd; > > > struct request *req; > > > > > > - if (!sdev) { > > > - while ((req = blk_peek_request(q)) != NULL) > > > - scsi_kill_request(req, q); > > > - return; > > > - } > > > > That means that this hunk of code has to stay, but needs to be gated on > > blk_queue_dead(q); there's still a race where this can occur. > > Wouldn't the scsi_device_online() check down below be enough? Block > layer drain is gonna loop until all requests are done, so the looping > is handled from block layer. It might be ... in theory the teardown is supposed to happen in SDEV_CANCEL and be done by SDEV_DEL. However, I'm not sure that's entirely true now. blk_queue_dead() is safer since we know we just killed the queue. Another reason for doing it like this is that the kill on queue dead isn't noisy ... the one on !online is ... and logs were getting stuffed with messages about killing requests to dead queues. James -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html