This is a note to let you know that I've just added the patch titled block: factor out a blk_debugfs_remove helper to the 6.1-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: block-factor-out-a-blk_debugfs_remove-helper.patch and it can be found in the queue-6.1 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. commit a470755911a1d91ec554013211b835d0032051ab Author: Christoph Hellwig <hch@xxxxxx> Date: Mon Nov 14 05:26:34 2022 +0100 block: factor out a blk_debugfs_remove helper [ Upstream commit 6fc75f309d291d328b4ea2f91bef0ff56e4bc7c2 ] Split the debugfs removal from blk_unregister_queue into a helper so that the it can be reused for blk_register_queue error handling. Signed-off-by: Christoph Hellwig <hch@xxxxxx> Link: https://lore.kernel.org/r/20221114042637.1009333-3-hch@xxxxxx Signed-off-by: Jens Axboe <axboe@xxxxxxxxx> Stable-dep-of: 49e4d04f0486 ("block: Drop spurious might_sleep() from blk_put_queue()") Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx> diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c index 2b1cf0b2a5c7..3d6951a0b4e7 100644 --- a/block/blk-sysfs.c +++ b/block/blk-sysfs.c @@ -797,6 +797,19 @@ struct kobj_type blk_queue_ktype = { .release = blk_release_queue, }; +static void blk_debugfs_remove(struct gendisk *disk) +{ + struct request_queue *q = disk->queue; + + mutex_lock(&q->debugfs_mutex); + blk_trace_shutdown(q); + debugfs_remove_recursive(q->debugfs_dir); + q->debugfs_dir = NULL; + q->sched_debugfs_dir = NULL; + q->rqos_debugfs_dir = NULL; + mutex_unlock(&q->debugfs_mutex); +} + /** * blk_register_queue - register a block layer queue with sysfs * @disk: Disk of which the request queue should be registered with sysfs. @@ -922,11 +935,5 @@ void blk_unregister_queue(struct gendisk *disk) kobject_del(&q->kobj); mutex_unlock(&q->sysfs_dir_lock); - mutex_lock(&q->debugfs_mutex); - blk_trace_shutdown(q); - debugfs_remove_recursive(q->debugfs_dir); - q->debugfs_dir = NULL; - q->sched_debugfs_dir = NULL; - q->rqos_debugfs_dir = NULL; - mutex_unlock(&q->debugfs_mutex); + blk_debugfs_remove(disk); }