diff options
author | Jens Axboe <axboe@fb.com> | 2014-09-16 12:37:37 -0400 |
---|---|---|
committer | Jens Axboe <axboe@fb.com> | 2014-09-22 13:54:04 -0400 |
commit | 538b75341835e3c2041ff066408de10d24fdc830 (patch) | |
tree | 6b7b60f296779302cc70d7c79e47b4dcc440a9be /block | |
parent | 37504a3be90b69438426d74ccf467a9fe192932b (diff) |
blk-mq: request deadline must be visible before marking rq as started
When we start the request, we set the deadline and flip the bits
marking the request as started and non-complete. However, it's
important that the deadline store is ordered before flipping the
bits, otherwise we could have a small window where the request is
marked started but with an invalid deadline. This can confuse the
timeout handling.
Suggested-by: Ming Lei <tom.leiming@gmail.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'block')
-rw-r--r-- | block/blk-mq.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/block/blk-mq.c b/block/blk-mq.c index 383ea0cb1f0a..a13c40ca8230 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c | |||
@@ -393,6 +393,12 @@ static void blk_mq_start_request(struct request *rq, bool last) | |||
393 | blk_add_timer(rq); | 393 | blk_add_timer(rq); |
394 | 394 | ||
395 | /* | 395 | /* |
396 | * Ensure that ->deadline is visible before set the started | ||
397 | * flag and clear the completed flag. | ||
398 | */ | ||
399 | smp_mb__before_atomic(); | ||
400 | |||
401 | /* | ||
396 | * Mark us as started and clear complete. Complete might have been | 402 | * Mark us as started and clear complete. Complete might have been |
397 | * set if requeue raced with timeout, which then marked it as | 403 | * set if requeue raced with timeout, which then marked it as |
398 | * complete. So be sure to clear complete again when we start | 404 | * complete. So be sure to clear complete again when we start |