* [PATCH] set error value when failing block pc commands
@ 2005-09-09 19:27 Mike Christie
0 siblings, 0 replies; only message in thread
From: Mike Christie @ 2005-09-09 19:27 UTC (permalink / raw)
To: SCSI Mailing List
If a block pc request is failed in the request_fn or prep_fn we are not
setting a error value. This is a problem for dm-multipath's path
testers and hw_handlers and everyone doing SG_IO since they
see the command as completing successfully.
Patch was made against scsi-misc.
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -1047,6 +1047,10 @@ static int scsi_init_io(struct scsi_cmnd
/* release the command and kill it */
scsi_release_buffers(cmd);
scsi_put_command(cmd);
+
+ if (blk_pc_request(req))
+ req->errors = DID_NO_CONNECT << 16;
+
return BLKPREP_KILL;
}
@@ -1118,6 +1122,8 @@ static int scsi_prep_fn(struct request_q
if (unlikely(!scsi_device_online(sdev))) {
printk(KERN_ERR "scsi%d (%d:%d): rejecting I/O to offline device\n",
sdev->host->host_no, sdev->id, sdev->lun);
+ if (blk_pc_request(req))
+ req->errors = DID_NO_CONNECT << 16;
return BLKPREP_KILL;
}
if (unlikely(sdev->sdev_state != SDEV_RUNNING)) {
@@ -1128,6 +1134,8 @@ static int scsi_prep_fn(struct request_q
* at all allowed down */
printk(KERN_ERR "scsi%d (%d:%d): rejecting I/O to dead device\n",
sdev->host->host_no, sdev->id, sdev->lun);
+ if (blk_pc_request(req))
+ req->errors = DID_NO_CONNECT << 16;
return BLKPREP_KILL;
}
/* OK, we only allow special commands (i.e. not
@@ -1164,6 +1172,10 @@ static int scsi_prep_fn(struct request_q
printk(KERN_ERR "scsi%d (%d:%d): rejecting I/O to device being removed\n",
sdev->host->host_no, sdev->id, sdev->lun);
+
+ if (blk_pc_request(req))
+ req->errors = DID_NO_CONNECT << 16;
+
return BLKPREP_KILL;
}
@@ -1231,6 +1243,10 @@ static int scsi_prep_fn(struct request_q
if (unlikely(!drv->init_command(cmd))) {
scsi_release_buffers(cmd);
scsi_put_command(cmd);
+
+ if (blk_pc_request(req))
+ req->errors = DID_NO_CONNECT << 16;
+
return BLKPREP_KILL;
}
} else {
@@ -1345,6 +1361,8 @@ static void scsi_kill_requests(request_q
while ((req = elv_next_request(q)) != NULL) {
blkdev_dequeue_request(req);
req->flags |= REQ_QUIET;
+ if (blk_pc_request(req))
+ req->errors = DID_NO_CONNECT << 16;
while (end_that_request_first(req, 0, req->nr_sectors))
;
end_that_request_last(req);
@@ -1400,6 +1418,8 @@ static void scsi_request_fn(struct reque
sdev->host->host_no, sdev->id, sdev->lun);
blkdev_dequeue_request(req);
req->flags |= REQ_QUIET;
+ if (blk_pc_request(req))
+ req->errors = DID_NO_CONNECT << 16;
while (end_that_request_first(req, 0, req->nr_sectors))
;
end_that_request_last(req);
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2005-09-09 19:27 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-09-09 19:27 [PATCH] set error value when failing block pc commands Mike Christie
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.