ioc_qos_write() calls blkg_conf_close_bdev() before blk_mq_unfreeze_queue(). close_bdev drops the bdev reference the writer holds; if that is the last reference, the queue enters its release path and only the RCU-delayed free in blk_free_queue() keeps it alive across the unfreeze. Unfreeze before the close instead, while the writer's own bdev reference still pins the queue, matching ioc_cost_model_write(). Fixes: 9730763f4756 ("block: correct locking order for protecting blk-wbt parameters") Cc: stable@vger.kernel.org Signed-off-by: Guixin Liu --- block/blk-iocost.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/block/blk-iocost.c b/block/blk-iocost.c index 8e06b83691aa..b251ecc66d8a 100644 --- a/block/blk-iocost.c +++ b/block/blk-iocost.c @@ -3370,7 +3370,6 @@ static ssize_t ioc_qos_write(struct kernfs_open_file *of, char *input, size_t nbytes, loff_t off) { struct blkg_conf_ctx ctx; - struct request_queue *q; struct gendisk *disk; struct ioc *ioc; u32 qos[NR_QOS_PARAMS]; @@ -3511,9 +3510,8 @@ static ssize_t ioc_qos_write(struct kernfs_open_file *of, char *input, blk_mq_unquiesce_queue(disk->queue); close_bdev: - q = ctx.bdev->bd_queue; + blk_mq_unfreeze_queue(ctx.bdev->bd_queue, memflags); blkg_conf_close_bdev(&ctx); - blk_mq_unfreeze_queue(q, memflags); return ret ?: nbytes; einval: -- 2.43.7