blk_flush_complete_seq() and blk_kick_flush() modify the flush queue state and hence must be called with fq->mq_flush_lock held. Annotate both functions with __must_hold(&fq->mq_flush_lock). Annotate both the forward declaration and the definition of blk_kick_flush(). Signed-off-by: Bart Van Assche --- block/blk-flush.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/block/blk-flush.c b/block/blk-flush.c index 38bd4ae5d9e7..34220e2dc480 100644 --- a/block/blk-flush.c +++ b/block/blk-flush.c @@ -92,7 +92,8 @@ enum { }; static void blk_kick_flush(struct request_queue *q, - struct blk_flush_queue *fq, blk_opf_t flags); + struct blk_flush_queue *fq, blk_opf_t flags) + __must_hold(&fq->mq_flush_lock); static inline struct blk_flush_queue * blk_get_flush_queue(struct blk_mq_ctx *ctx) @@ -148,6 +149,7 @@ static void blk_account_io_flush(struct request *rq) static void blk_flush_complete_seq(struct request *rq, struct blk_flush_queue *fq, unsigned int seq, blk_status_t error) + __must_hold(&fq->mq_flush_lock) { struct request_queue *q = rq->q; struct list_head *pending = &fq->flush_queue[fq->flush_pending_idx]; @@ -281,6 +283,7 @@ bool is_flush_rq(struct request *rq) */ static void blk_kick_flush(struct request_queue *q, struct blk_flush_queue *fq, blk_opf_t flags) + __must_hold(&fq->mq_flush_lock) { struct list_head *pending = &fq->flush_queue[fq->flush_pending_idx]; struct request *first_rq =