From: Yu Kuai yukuai3@huawei.com
hulk inclusion category: bugfix bugzilla: 34280, https://gitee.com/openeuler/kernel/issues/I4AKY4 CVE: NA
-----------------------------------------------
Prepare to fix kernel panic during iterating over flush request, no functional changes.
Signed-off-by: Yu Kuai yukuai3@huawei.com Reviewed-by: Hou Tao houtao1@huawei.com Signed-off-by: Yang Yingliang yangyingliang@huawei.com --- block/blk-core.c | 7 ++++++- block/blk.h | 1 + 2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/block/blk-core.c b/block/blk-core.c index 34456f2bf45c3..9d2a5a8c78d49 100644 --- a/block/blk-core.c +++ b/block/blk-core.c @@ -183,7 +183,7 @@ void blk_queue_congestion_threshold(struct request_queue *q) q->nr_congestion_off = nr; }
-void blk_rq_init(struct request_queue *q, struct request *rq) +void __blk_rq_init(struct request_queue *q, struct request *rq) { memset(rq, 0, sizeof(*rq));
@@ -198,6 +198,11 @@ void blk_rq_init(struct request_queue *q, struct request *rq) rq->internal_tag = -1; rq->start_time_ns = ktime_get_ns(); rq->part = NULL; +} + +void blk_rq_init(struct request_queue *q, struct request *rq) +{ + __blk_rq_init(q, rq); refcount_set(&rq->ref, 1); } EXPORT_SYMBOL(blk_rq_init); diff --git a/block/blk.h b/block/blk.h index ae87e2a5f2bd1..9aeb559d6c93c 100644 --- a/block/blk.h +++ b/block/blk.h @@ -246,6 +246,7 @@ int elevator_switch_mq(struct request_queue *q, void elevator_exit(struct request_queue *, struct elevator_queue *); int elv_register_queue(struct request_queue *q, bool uevent); void elv_unregister_queue(struct request_queue *q); +void __blk_rq_init(struct request_queue *q, struct request *rq);
struct hd_struct *__disk_get_part(struct gendisk *disk, int partno);