aboutsummaryrefslogtreecommitdiffstats
path: root/block/blk-flush.c
diff options
context:
space:
mode:
authorBruce Ashfield <bruce.ashfield@gmail.com>2020-01-14 11:07:11 -0500
committerBruce Ashfield <bruce.ashfield@gmail.com>2020-01-14 11:07:11 -0500
commitaf97e71deeb9244528b7cc6b6520b71ba0852261 (patch)
tree72c187e3ee20aded526b38308d018fc8073e289b /block/blk-flush.c
parentef283bb23883069e248fca8b4099c7dab9ddc8b6 (diff)
parent9d61432efb21c224b710f397809f3a4fef281f9c (diff)
downloadlinux-yocto-master.tar.gz
linux-yocto-master.tar.bz2
linux-yocto-master.zip
Merge branch 'master-5.4'HEADmaster
Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
Diffstat (limited to 'block/blk-flush.c')
-rw-r--r--block/blk-flush.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/block/blk-flush.c b/block/blk-flush.c
index aedd9320e605..b1f0a1ac505c 100644
--- a/block/blk-flush.c
+++ b/block/blk-flush.c
@@ -69,6 +69,7 @@
#include <linux/blkdev.h>
#include <linux/gfp.h>
#include <linux/blk-mq.h>
+#include <linux/lockdep.h>
#include "blk.h"
#include "blk-mq.h"
@@ -214,6 +215,16 @@ static void flush_end_io(struct request *flush_rq, blk_status_t error)
/* release the tag's ownership to the req cloned from */
spin_lock_irqsave(&fq->mq_flush_lock, flags);
+
+ if (!refcount_dec_and_test(&flush_rq->ref)) {
+ fq->rq_status = error;
+ spin_unlock_irqrestore(&fq->mq_flush_lock, flags);
+ return;
+ }
+
+ if (fq->rq_status != BLK_STS_OK)
+ error = fq->rq_status;
+
hctx = flush_rq->mq_hctx;
if (!q->elevator) {
blk_mq_tag_set_rq(hctx, flush_rq->tag, fq->orig_rq);
@@ -482,6 +493,9 @@ struct blk_flush_queue *blk_alloc_flush_queue(struct request_queue *q,
INIT_LIST_HEAD(&fq->flush_queue[1]);
INIT_LIST_HEAD(&fq->flush_data_in_flight);
+ lockdep_register_key(&fq->key);
+ lockdep_set_class(&fq->mq_flush_lock, &fq->key);
+
return fq;
fail_rq:
@@ -496,6 +510,7 @@ void blk_free_flush_queue(struct blk_flush_queue *fq)
if (!fq)
return;
+ lockdep_unregister_key(&fq->key);
kfree(fq->flush_rq);
kfree(fq);
}