[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20211213092926.950166266@linuxfoundation.org>
Date: Mon, 13 Dec 2021 10:29:53 +0100
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: linux-kernel@...r.kernel.org
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
stable@...r.kernel.org, Manjong Lee <mj0123.lee@...sung.com>,
"Peter Zijlstra (Intel)" <peterz@...radead.org>,
Changheun Lee <nanich.lee@...sung.com>,
Jens Axboe <axboe@...nel.dk>,
Christoph Hellwig <hch@...radead.org>,
Matthew Wilcox <willy@...radead.org>,
seunghwan.hyun@...sung.com, sookwan7.kim@...sung.com,
yt0928.kim@...sung.com, junho89.kim@...sung.com,
jisoo2146.oh@...sung.com,
Andrew Morton <akpm@...ux-foundation.org>,
Linus Torvalds <torvalds@...ux-foundation.org>
Subject: [PATCH 4.9 11/42] mm: bdi: initialize bdi_min_ratio when bdi is unregistered
From: Manjong Lee <mj0123.lee@...sung.com>
commit 3c376dfafbf7a8ea0dea212d095ddd83e93280bb upstream.
Initialize min_ratio if it is set during bdi unregistration. This can
prevent problems that may occur a when bdi is removed without resetting
min_ratio.
For example.
1) insert external sdcard
2) set external sdcard's min_ratio 70
3) remove external sdcard without setting min_ratio 0
4) insert external sdcard
5) set external sdcard's min_ratio 70 << error occur(can't set)
Because when an sdcard is removed, the present bdi_min_ratio value will
remain. Currently, the only way to reset bdi_min_ratio is to reboot.
[akpm@...ux-foundation.org: tweak comment and coding style]
Link: https://lkml.kernel.org/r/20211021161942.5983-1-mj0123.lee@samsung.com
Signed-off-by: Manjong Lee <mj0123.lee@...sung.com>
Acked-by: Peter Zijlstra (Intel) <peterz@...radead.org>
Cc: Changheun Lee <nanich.lee@...sung.com>
Cc: Jens Axboe <axboe@...nel.dk>
Cc: Christoph Hellwig <hch@...radead.org>
Cc: Matthew Wilcox <willy@...radead.org>
Cc: <seunghwan.hyun@...sung.com>
Cc: <sookwan7.kim@...sung.com>
Cc: <yt0928.kim@...sung.com>
Cc: <junho89.kim@...sung.com>
Cc: <jisoo2146.oh@...sung.com>
Cc: <stable@...r.kernel.org>
Signed-off-by: Andrew Morton <akpm@...ux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@...ux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
---
mm/backing-dev.c | 7 +++++++
1 file changed, 7 insertions(+)
--- a/mm/backing-dev.c
+++ b/mm/backing-dev.c
@@ -865,6 +865,13 @@ void bdi_unregister(struct backing_dev_i
wb_shutdown(&bdi->wb);
cgwb_bdi_destroy(bdi);
+ /*
+ * If this BDI's min ratio has been set, use bdi_set_min_ratio() to
+ * update the global bdi_min_ratio.
+ */
+ if (bdi->min_ratio)
+ bdi_set_min_ratio(bdi, 0);
+
if (bdi->dev) {
bdi_debug_unregister(bdi);
device_unregister(bdi->dev);
Powered by blists - more mailing lists