Commit 5fa3d1a0 authored by Li Nan's avatar Li Nan Committed by Jens Axboe

block: Set memalloc_noio to false on device_add_disk() error path

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: 25e823c8 ("block/genhd.c: apply pm_runtime_set_memalloc_noio on block devices")
Signed-off-by: default avatarLi Nan <linan122@huawei.com>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/20231211075356.1839282-1-linan666@huaweicloud.comSigned-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 9e4bf6a0
...@@ -542,6 +542,7 @@ int __must_check device_add_disk(struct device *parent, struct gendisk *disk, ...@@ -542,6 +542,7 @@ int __must_check device_add_disk(struct device *parent, struct gendisk *disk,
kobject_put(disk->part0->bd_holder_dir); kobject_put(disk->part0->bd_holder_dir);
out_del_block_link: out_del_block_link:
sysfs_remove_link(block_depr, dev_name(ddev)); sysfs_remove_link(block_depr, dev_name(ddev));
pm_runtime_set_memalloc_noio(ddev, false);
out_device_del: out_device_del:
device_del(ddev); device_del(ddev);
out_free_ext_minor: out_free_ext_minor:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment