]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
block: Set memalloc_noio to false on device_add_disk() error path
authorLi Nan <linan122@huawei.com>
Mon, 11 Dec 2023 07:53:56 +0000 (15:53 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 25 Jan 2024 22:52:38 +0000 (14:52 -0800)
[ 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@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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
block/genhd.c

index 6123f13e148e00a818d1492d705b8b19288a3abe..578c09077946008a1562ac39accb5a275742c09c 100644 (file)
@@ -538,6 +538,7 @@ out_del_integrity:
 out_del_block_link:
        if (!sysfs_deprecated)
                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: