This is a note to let you know that I've just added the patch titled block: Set memalloc_noio to false on device_add_disk() error path to the 5.15-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-set-memalloc_noio-to-false-on-device_add_disk-.patch and it can be found in the queue-5.15 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. commit 81505f29b0c1c4f14750259834f7b268d49127d8 Author: Li Nan <linan122@xxxxxxxxxx> Date: Mon Dec 11 15:53:56 2023 +0800 block: Set memalloc_noio to false on device_add_disk() error path [ Upstream commit 5fa3d1a00c2d4ba14f1300371ad39d5456e890d7 ] On the error path of device_add_disk(), device's memalloc_noio flag was set but not cleared. As the comment of pm_runtime_set_memalloc_noio(), "The function should be called between device_add() and device_del()". Clear this flag before device_del() now. Fixes: 25e823c8c37d ("block/genhd.c: apply pm_runtime_set_memalloc_noio on block devices") Signed-off-by: Li Nan <linan122@xxxxxxxxxx> Reviewed-by: Christoph Hellwig <hch@xxxxxx> Link: https://lore.kernel.org/r/20231211075356.1839282-1-linan666@xxxxxxxxxxxxxxx Signed-off-by: Jens Axboe <axboe@xxxxxxxxx> Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx> diff --git a/block/genhd.c b/block/genhd.c index 62dd331db639..6aef540bbacf 100644 --- a/block/genhd.c +++ b/block/genhd.c @@ -535,6 +535,7 @@ int device_add_disk(struct device *parent, struct gendisk *disk, blk_integrity_del(disk); out_del_block_link: sysfs_remove_link(block_depr, dev_name(ddev)); + pm_runtime_set_memalloc_noio(ddev, false); out_device_del: device_del(ddev); out_free_ext_minor: