Skip to content

Commit

Permalink
block: fix an oops on BLKPREP_KILL
Browse files Browse the repository at this point in the history
Doing a bit of torture testing, I ran across a BUG in the block
subsystem (at blk-core.c:2048): the test for if the request is queued.

It turns out the trigger was a BLKPREP_KILL coming out of the SCSI prep
function.  Currently for BLKPREP_KILL requests, we send them straight
into __blk_end_request_all() with an error, but they've never been
dequeued, so they trip the bug.  Fix this by starting requests before
killing them.

Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
  • Loading branch information
James Bottomley authored and Jens Axboe committed May 30, 2009
1 parent 5d85d32 commit c143dc9
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions block/blk-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1789,6 +1789,11 @@ struct request *blk_peek_request(struct request_queue *q)
break;
} else if (ret == BLKPREP_KILL) {
rq->cmd_flags |= REQ_QUIET;
/*
* Mark this request as started so we don't trigger
* any debug logic in the end I/O path.
*/
blk_start_request(rq);
__blk_end_request_all(rq, -EIO);
} else {
printk(KERN_ERR "%s: bad return=%d\n", __func__, ret);
Expand Down

0 comments on commit c143dc9

Please sign in to comment.