summaryrefslogtreecommitdiffstats
path: root/block/blk-mq.c
diff options
context:
space:
mode:
authorJens Axboe <axboe@fb.com>2014-05-09 14:54:08 -0600
committerJens Axboe <axboe@fb.com>2014-05-09 14:54:08 -0600
commitcf4b50afc28cc4629f82f5591bef1db2ce129fdc (patch)
tree021ac302ac256c4fd3a03b740a0c823e69644b89 /block/blk-mq.c
parent4bb659b156996f2993dc16fad71fec9ee070153c (diff)
downloadop-kernel-dev-cf4b50afc28cc4629f82f5591bef1db2ce129fdc.zip
op-kernel-dev-cf4b50afc28cc4629f82f5591bef1db2ce129fdc.tar.gz
blk-mq: fix race in IO start accounting
Commit c6d600c6 opened up a small race where we could attempt to account IO completion on a request, racing with IO start accounting. Fix this up by ensuring that we've accounted for IO start before inserting the request. Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'block/blk-mq.c')
-rw-r--r--block/blk-mq.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/block/blk-mq.c b/block/blk-mq.c
index 9f07a26..526feee 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -1088,17 +1088,15 @@ static void blk_mq_make_request(struct request_queue *q, struct bio *bio)
}
if (!(hctx->flags & BLK_MQ_F_SHOULD_MERGE)) {
- init_request_from_bio(rq, bio);
-
+ blk_mq_bio_to_request(rq, bio);
spin_lock(&ctx->lock);
insert_rq:
__blk_mq_insert_request(hctx, rq, false);
spin_unlock(&ctx->lock);
- blk_account_io_start(rq, 1);
} else {
spin_lock(&ctx->lock);
if (!blk_mq_attempt_merge(q, ctx, bio)) {
- init_request_from_bio(rq, bio);
+ blk_mq_bio_to_request(rq, bio);
goto insert_rq;
}
OpenPOWER on IntegriCloud