mirror of https://gitee.com/openkylin/linux.git
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: b685d3d65a
("block: treat REQ_FUA and REQ_PREFLUSH as synchronous")
Signed-off-by: Jens Axboe <axboe@fb.com>
This commit is contained in:
parent
b57d74aff9
commit
ae5b2ec8ad
|
@ -395,6 +395,13 @@ void blk_insert_flush(struct request *rq)
|
||||||
if (!(fflags & (1UL << QUEUE_FLAG_FUA)))
|
if (!(fflags & (1UL << QUEUE_FLAG_FUA)))
|
||||||
rq->cmd_flags &= ~REQ_FUA;
|
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
|
* An empty flush handed down from a stacking driver may
|
||||||
* translate into nothing if the underlying device does not
|
* translate into nothing if the underlying device does not
|
||||||
|
|
Loading…
Reference in New Issue