linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] block: Set memalloc_noio to false in the error path
@ 2023-10-25  7:54 Zhong Jinghua
  2023-10-26 21:14 ` Luis Chamberlain
  0 siblings, 1 reply; 2+ messages in thread
From: Zhong Jinghua @ 2023-10-25  7:54 UTC (permalink / raw)
  To: axboe, mcgrof, hare
  Cc: linux-block, linux-kernel, zhongjinghua, yi.zhang, yukuai3,
	yangerkun

From: Zhong Jinghua <zhongjinghua@huawei.com>

In del_gendisk, memalloc_noio is set to false, so it would be better to do
the same thing in the error path.

Fixes: 83cbce957446 ("block: add error handling for device_add_disk / add_disk")
Signed-off-by: Zhong Jinghua <zhongjinghua@huawei.com>
---
 block/genhd.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/block/genhd.c b/block/genhd.c
index 3d287b32d50d..736215e9ddc3 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -542,6 +542,11 @@ 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));
+	/*
+	 * The error path needs to set memalloc_noio to false
+	 * consistent with del_gendisk.
+	 */
+	 pm_runtime_set_memalloc_noio(ddev, false);
 out_device_del:
 	device_del(ddev);
 out_free_ext_minor:
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] block: Set memalloc_noio to false in the error path
  2023-10-25  7:54 [PATCH] block: Set memalloc_noio to false in the error path Zhong Jinghua
@ 2023-10-26 21:14 ` Luis Chamberlain
  0 siblings, 0 replies; 2+ messages in thread
From: Luis Chamberlain @ 2023-10-26 21:14 UTC (permalink / raw)
  To: Zhong Jinghua
  Cc: axboe, hare, linux-block, linux-kernel, zhongjinghua, yi.zhang,
	yukuai3, yangerkun

On Wed, Oct 25, 2023 at 03:54:36PM +0800, Zhong Jinghua wrote:
> From: Zhong Jinghua <zhongjinghua@huawei.com>
> 
> In del_gendisk, memalloc_noio is set to false, so it would be better to do
> the same thing in the error path.

The commit does not mention what happens if this is not done.

  Luis

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-10-26 21:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-25  7:54 [PATCH] block: Set memalloc_noio to false in the error path Zhong Jinghua
2023-10-26 21:14 ` Luis Chamberlain

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).