summaryrefslogtreecommitdiff
path: root/block/blk-flush.c
diff options
context:
space:
mode:
authorJens Axboe <axboe@fb.com>2016-11-08 19:39:28 -0700
committerJens Axboe <axboe@fb.com>2016-11-08 19:39:28 -0700
commitae5b2ec8ad5e017126cd4552220f25ce8a6b92e9 (patch)
tree8adef3f0d868cdb67dd8d4aba11edf210341ebdf /block/blk-flush.c
parentb57d74aff9ab92fbfb7c197c384d1adfa2827b2e (diff)
block: set REQ_SYNC if we clear REQ_FUA|REQ_PREFLUSH
If we insert a flush request, we clear REQ_PREFLUSH and/or REQ_FUA, depending on flush settings. Since op_is_sync() factors those flags in for deciding whether this request is sync or not, we should set REQ_SYNC to avoid screwing up this accounting. This should be less fragile. Reported-by: Logan Gunthorpe <logang@deltatee.com> Fixes: b685d3d65ac ("block: treat REQ_FUA and REQ_PREFLUSH as synchronous") Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'block/blk-flush.c')
-rw-r--r--block/blk-flush.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/block/blk-flush.c b/block/blk-flush.c
index c486b7aa62ee..1bdbb3d3e5f5 100644
--- a/block/blk-flush.c
+++ b/block/blk-flush.c
@@ -396,6 +396,13 @@ void blk_insert_flush(struct request *rq)
rq->cmd_flags &= ~REQ_FUA;
/*
+ * REQ_PREFLUSH|REQ_FUA implies REQ_SYNC, so if we clear any
+ * of those flags, we have to set REQ_SYNC to avoid skewing
+ * the request accounting.
+ */
+ rq->cmd_flags |= REQ_SYNC;
+
+ /*
* An empty flush handed down from a stacking driver may
* translate into nothing if the underlying device does not
* advertise a write-back cache. In this case, simply