summaryrefslogtreecommitdiffstats
path: root/block/blk-mq-sched.h
diff options
context:
space:
mode:
authorJens Axboe <axboe@fb.com>2017-02-03 11:48:28 -0500
committerJens Axboe <axboe@fb.com>2017-02-03 11:48:28 -0500
commite4d750c97794ea2bab793d4c518b1f4006364588 (patch)
tree8b351d08b1d81986402964a243268e70bb31a6a9 /block/blk-mq-sched.h
parentb973cb7e89fe3dcc2bc72c5b3aa7a3bfd9d0e6d5 (diff)
block: free merged request in the caller
If we end up doing a request-to-request merge when we have completed a bio-to-request merge, we free the request from deep down in that path. For blk-mq-sched, the merge path has to hold the appropriate lock, but we don't need it for freeing the request. And in fact holding the lock is problematic, since we are now calling the mq sched put_rq_private() hook with the lock held. Other call paths do not hold this lock. Fix this inconsistency by ensuring that the caller frees a merged request. Then we can do it outside of the lock, making it both more efficient and fixing the blk-mq-sched problem of invoking parts of the scheduler with an unknown lock state. Reported-by: Paolo Valente <paolo.valente@linaro.org> Signed-off-by: Jens Axboe <axboe@fb.com> Reviewed-by: Omar Sandoval <osandov@fb.com>
Diffstat (limited to 'block/blk-mq-sched.h')
-rw-r--r--block/blk-mq-sched.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/block/blk-mq-sched.h b/block/blk-mq-sched.h
index add5f090a8cd..5954859c8670 100644
--- a/block/blk-mq-sched.h
+++ b/block/blk-mq-sched.h
@@ -15,7 +15,8 @@ struct request *blk_mq_sched_get_request(struct request_queue *q, struct bio *bi
15void blk_mq_sched_put_request(struct request *rq); 15void blk_mq_sched_put_request(struct request *rq);
16 16
17void blk_mq_sched_request_inserted(struct request *rq); 17void blk_mq_sched_request_inserted(struct request *rq);
18bool blk_mq_sched_try_merge(struct request_queue *q, struct bio *bio); 18bool blk_mq_sched_try_merge(struct request_queue *q, struct bio *bio,
19 struct request **merged_request);
19bool __blk_mq_sched_bio_merge(struct request_queue *q, struct bio *bio); 20bool __blk_mq_sched_bio_merge(struct request_queue *q, struct bio *bio);
20bool blk_mq_sched_try_insert_merge(struct request_queue *q, struct request *rq); 21bool blk_mq_sched_try_insert_merge(struct request_queue *q, struct request *rq);
21void blk_mq_sched_restart_queues(struct blk_mq_hw_ctx *hctx); 22void blk_mq_sched_restart_queues(struct blk_mq_hw_ctx *hctx);