blk-mq: move failure injection out of blk_mq_complete_request
Move the call to blk_should_fake_timeout out of blk_mq_complete_request and into the drivers, skipping call sites that are obvious error handlers, and remove the now superflous blk_mq_force_complete_rq helper. This ensures we don't keep injecting errors into completions that just terminate the Linux request after the hardware has been reset or the command has been aborted. Reviewed-by: Daniel Wagner <dwagner@suse.de> Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:

committed by
Jens Axboe

parent
d391a7a399
commit
15f73f5b3e
@@ -503,8 +503,7 @@ void __blk_mq_end_request(struct request *rq, blk_status_t error);
|
||||
void blk_mq_requeue_request(struct request *rq, bool kick_requeue_list);
|
||||
void blk_mq_kick_requeue_list(struct request_queue *q);
|
||||
void blk_mq_delay_kick_requeue_list(struct request_queue *q, unsigned long msecs);
|
||||
bool blk_mq_complete_request(struct request *rq);
|
||||
void blk_mq_force_complete_rq(struct request *rq);
|
||||
void blk_mq_complete_request(struct request *rq);
|
||||
bool blk_mq_bio_list_merge(struct request_queue *q, struct list_head *list,
|
||||
struct bio *bio, unsigned int nr_segs);
|
||||
bool blk_mq_queue_stopped(struct request_queue *q);
|
||||
@@ -537,6 +536,15 @@ void blk_mq_quiesce_queue_nowait(struct request_queue *q);
|
||||
|
||||
unsigned int blk_mq_rq_cpu(struct request *rq);
|
||||
|
||||
bool __blk_should_fake_timeout(struct request_queue *q);
|
||||
static inline bool blk_should_fake_timeout(struct request_queue *q)
|
||||
{
|
||||
if (IS_ENABLED(CONFIG_FAIL_IO_TIMEOUT) &&
|
||||
test_bit(QUEUE_FLAG_FAIL_IO, &q->queue_flags))
|
||||
return __blk_should_fake_timeout(q);
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* blk_mq_rq_from_pdu - cast a PDU to a request
|
||||
* @pdu: the PDU (Protocol Data Unit) to be casted
|
||||
|
Reference in New Issue
Block a user