* [PATCH] block: Set memalloc_noio to false on device_add_disk() error path
@ 2023-12-11 7:53 linan666
2023-12-11 16:49 ` Christoph Hellwig
2023-12-13 15:20 ` Jens Axboe
0 siblings, 2 replies; 3+ messages in thread
From: linan666 @ 2023-12-11 7:53 UTC (permalink / raw)
To: axboe, akpm, ming.lei
Cc: linux-block, linux-kernel, linan666, yukuai3, yi.zhang, houtao1,
yangerkun
From: Li Nan <linan122@huawei.com>
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>
---
block/genhd.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/block/genhd.c b/block/genhd.c
index c9d06f72c587..13db3a7943d8 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -542,6 +542,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:
--
2.39.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] block: Set memalloc_noio to false on device_add_disk() error path
2023-12-11 7:53 [PATCH] block: Set memalloc_noio to false on device_add_disk() error path linan666
@ 2023-12-11 16:49 ` Christoph Hellwig
2023-12-13 15:20 ` Jens Axboe
1 sibling, 0 replies; 3+ messages in thread
From: Christoph Hellwig @ 2023-12-11 16:49 UTC (permalink / raw)
To: linan666
Cc: axboe, akpm, ming.lei, linux-block, linux-kernel, yukuai3,
yi.zhang, houtao1, yangerkun
On Mon, Dec 11, 2023 at 03:53:56PM +0800, linan666@huaweicloud.com wrote:
> From: Li Nan <linan122@huawei.com>
>
> 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.
Looks good:
Reviewed-by: Christoph Hellwig <hch@lst.de>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] block: Set memalloc_noio to false on device_add_disk() error path
2023-12-11 7:53 [PATCH] block: Set memalloc_noio to false on device_add_disk() error path linan666
2023-12-11 16:49 ` Christoph Hellwig
@ 2023-12-13 15:20 ` Jens Axboe
1 sibling, 0 replies; 3+ messages in thread
From: Jens Axboe @ 2023-12-13 15:20 UTC (permalink / raw)
To: akpm, ming.lei, linan666
Cc: linux-block, linux-kernel, yukuai3, yi.zhang, houtao1, yangerkun
On Mon, 11 Dec 2023 15:53:56 +0800, linan666@huaweicloud.com wrote:
> 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.
>
>
Applied, thanks!
[1/1] block: Set memalloc_noio to false on device_add_disk() error path
commit: 5fa3d1a00c2d4ba14f1300371ad39d5456e890d7
Best regards,
--
Jens Axboe
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-12-13 15:20 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-11 7:53 [PATCH] block: Set memalloc_noio to false on device_add_disk() error path linan666
2023-12-11 16:49 ` Christoph Hellwig
2023-12-13 15:20 ` Jens Axboe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox