Skip to content

Commit 84fca1b

Browse files
hreineckeaxboe
authored andcommitted
block: pass failfast and driver-specific flags to flush requests
If flush requests are being sent to the device we need to inherit the failfast and driver-specific flags, too, otherwise I/O will fail. Reviewed-by: Christoph Hellwig <[email protected]> Signed-off-by: Hannes Reinecke <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
1 parent 07ce213 commit 84fca1b

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

block/blk-flush.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ enum {
9494
};
9595

9696
static bool blk_kick_flush(struct request_queue *q,
97-
struct blk_flush_queue *fq);
97+
struct blk_flush_queue *fq, unsigned int flags);
9898

9999
static unsigned int blk_flush_policy(unsigned long fflags, struct request *rq)
100100
{
@@ -212,7 +212,7 @@ static bool blk_flush_complete_seq(struct request *rq,
212212
BUG();
213213
}
214214

215-
kicked = blk_kick_flush(q, fq);
215+
kicked = blk_kick_flush(q, fq, rq->cmd_flags);
216216
return kicked | queued;
217217
}
218218

@@ -281,6 +281,7 @@ static void flush_end_io(struct request *flush_rq, blk_status_t error)
281281
* blk_kick_flush - consider issuing flush request
282282
* @q: request_queue being kicked
283283
* @fq: flush queue
284+
* @flags: cmd_flags of the original request
284285
*
285286
* Flush related states of @q have changed, consider issuing flush request.
286287
* Please read the comment at the top of this file for more info.
@@ -291,7 +292,8 @@ static void flush_end_io(struct request *flush_rq, blk_status_t error)
291292
* RETURNS:
292293
* %true if flush was issued, %false otherwise.
293294
*/
294-
static bool blk_kick_flush(struct request_queue *q, struct blk_flush_queue *fq)
295+
static bool blk_kick_flush(struct request_queue *q, struct blk_flush_queue *fq,
296+
unsigned int flags)
295297
{
296298
struct list_head *pending = &fq->flush_queue[fq->flush_pending_idx];
297299
struct request *first_rq =
@@ -346,6 +348,7 @@ static bool blk_kick_flush(struct request_queue *q, struct blk_flush_queue *fq)
346348
}
347349

348350
flush_rq->cmd_flags = REQ_OP_FLUSH | REQ_PREFLUSH;
351+
flush_rq->cmd_flags |= (flags & REQ_DRV) | (flags & REQ_FAILFAST_MASK);
349352
flush_rq->rq_flags |= RQF_FLUSH_SEQ;
350353
flush_rq->rq_disk = first_rq->rq_disk;
351354
flush_rq->end_io = flush_end_io;

0 commit comments

Comments
 (0)