diff mbox

[TRUSTY,SRU] blk-mq: fix initializing request's start time

Message ID 1409239517-1112-1-git-send-email-chris.j.arges@canonical.com
State New
Headers show

Commit Message

Chris J Arges Aug. 28, 2014, 3:25 p.m. UTC
From: Ming Lei <tom.leiming@gmail.com>

BugLink: http://bugs.launchpad.net/bugs/1297522

blk_rq_init() is called in req's complete handler to initialize
the request, so the members of start_time and start_time_ns might
become inaccurate when it is allocated in future.

The patch initializes the two members in blk_mq_rq_ctx_init() to
fix the problem.

Signed-off-by: Ming Lei <tom.leiming@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
(cherry picked from commit 0fec08b4ecfc36fd8a64432343b2964fb86d2675)
Signed-off-by: Chris J Arges <chris.j.arges@canonical.com>
---
 block/blk-mq.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Tim Gardner Aug. 28, 2014, 4:10 p.m. UTC | #1
Good test results, clean cherry-pick.

Kamal - looks like good stable material.
diff mbox

Patch

diff --git a/block/blk-mq.c b/block/blk-mq.c
index 7f9b1f6..2192cf4 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -179,6 +179,8 @@  static void blk_mq_rq_ctx_init(struct request_queue *q, struct blk_mq_ctx *ctx,
 
 	rq->mq_ctx = ctx;
 	rq->cmd_flags = rw_flags;
+	rq->start_time = jiffies;
+	set_start_time_ns(rq);
 	ctx->rq_dispatched[rw_is_sync(rw_flags)]++;
 }