mainline inclusion from mainline-v6.7-rc1 commit 5fa3d1a00c2d4ba14f1300371ad39d5456e890d7 category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I8SCHN
Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?i...
--------------------------------------
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@huawei.com Reviewed-by: Christoph Hellwig hch@lst.de Link: https://lore.kernel.org/r/20231211075356.1839282-1-linan666@huaweicloud.com Signed-off-by: Jens Axboe axboe@kernel.dk --- block/genhd.c | 1 + 1 file changed, 1 insertion(+)
diff --git a/block/genhd.c b/block/genhd.c index 9aac842c3be4..fecf35759fdf 100644 --- a/block/genhd.c +++ b/block/genhd.c @@ -544,6 +544,7 @@ int __must_check device_add_disk(struct device *parent, struct gendisk *disk, kobject_put(disk->part0->bd_holder_dir); 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: