Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 8733
b: refs/heads/master
c: 6f16b53
h: refs/heads/master
i:
  8731: 66e0923
v: v3
  • Loading branch information
Mike Christie authored and James Bottomley committed Sep 11, 2005
1 parent ef7bc20 commit 01d43c5
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 9 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 146f7262ee0ec7fc6882f06e5fcb13883308073c
refs/heads/master: 6f16b5359ceb96780eac4178393b0e8a3c8aa1ea
24 changes: 16 additions & 8 deletions trunk/drivers/scsi/scsi_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -1146,7 +1146,7 @@ static int scsi_prep_fn(struct request_queue *q, struct request *req)
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);
return BLKPREP_KILL;
goto kill;
}
if (unlikely(sdev->sdev_state != SDEV_RUNNING)) {
/* OK, we're not in a running state don't prep
Expand All @@ -1156,7 +1156,7 @@ static int scsi_prep_fn(struct request_queue *q, struct request *req)
* 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);
return BLKPREP_KILL;
goto kill;
}
/* OK, we only allow special commands (i.e. not
* user initiated ones */
Expand Down Expand Up @@ -1188,11 +1188,11 @@ static int scsi_prep_fn(struct request_queue *q, struct request *req)
if(unlikely(specials_only) && !(req->flags & REQ_SPECIAL)) {
if(specials_only == SDEV_QUIESCE ||
specials_only == SDEV_BLOCK)
return BLKPREP_DEFER;
goto defer;

printk(KERN_ERR "scsi%d (%d:%d): rejecting I/O to device being removed\n",
sdev->host->host_no, sdev->id, sdev->lun);
return BLKPREP_KILL;
goto kill;
}


Expand All @@ -1210,7 +1210,7 @@ static int scsi_prep_fn(struct request_queue *q, struct request *req)
cmd->tag = req->tag;
} else {
blk_dump_rq_flags(req, "SCSI bad req");
return BLKPREP_KILL;
goto kill;
}

/* note the overloading of req->special. When the tag
Expand Down Expand Up @@ -1248,8 +1248,13 @@ static int scsi_prep_fn(struct request_queue *q, struct request *req)
* required).
*/
ret = scsi_init_io(cmd);
if (ret) /* BLKPREP_KILL return also releases the command */
return ret;
switch(ret) {
case BLKPREP_KILL:
/* BLKPREP_KILL return also releases the command */
goto kill;
case BLKPREP_DEFER:
goto defer;
}

/*
* Initialize the actual SCSI command for this request.
Expand All @@ -1259,7 +1264,7 @@ static int scsi_prep_fn(struct request_queue *q, struct request *req)
if (unlikely(!drv->init_command(cmd))) {
scsi_release_buffers(cmd);
scsi_put_command(cmd);
return BLKPREP_KILL;
goto kill;
}
} else {
memcpy(cmd->cmnd, req->cmd, sizeof(cmd->cmnd));
Expand Down Expand Up @@ -1290,6 +1295,9 @@ static int scsi_prep_fn(struct request_queue *q, struct request *req)
if (sdev->device_busy == 0)
blk_plug_device(q);
return BLKPREP_DEFER;
kill:
req->errors = DID_NO_CONNECT << 16;
return BLKPREP_KILL;
}

/*
Expand Down

0 comments on commit 01d43c5

Please sign in to comment.