From: Manjong Lee <mj0123.lee@samsung.com>
To: mj0123.lee@samsung.com, akpm@linux-foundation.org,
linux-mm@kvack.org, linux-kernel@vger.kernel.org
Cc: seunghwan.hyun@samsung.com, sookwan7.kim@samsung.com,
nanich.lee@samsung.com, yt0928.kim@samsung.com,
junho89.kim@samsung.com, jisoo2146.oh@samsung.com
Subject: [PATCH 1/1] mm: bdi: Initialize bdi_min_ratio when bdi unregister
Date: Fri, 22 Oct 2021 01:19:43 +0900 [thread overview]
Message-ID: <20211021161942.5983-1-mj0123.lee@samsung.com> (raw)
In-Reply-To: CGME20211021072307epcas1p4aa4388c13e71a66e3e1d5f7ee68b5a7f@epcas1p4.samsung.com
Initialize min_ratio if it is set when bdi unregister.
It can prevent problems that may occur 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 sdcard is removed, bdi_min_ratio value will remain.
Currently, the only way to reset bdi_ min_ratio is to reboot.
Signed-off-by: Manjong Lee <mj0123.lee@samsung.com>
---
mm/backing-dev.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/mm/backing-dev.c b/mm/backing-dev.c
index 4a9d4e27d0d9..ca53807be188 100644
--- a/mm/backing-dev.c
+++ b/mm/backing-dev.c
@@ -947,6 +947,11 @@ void bdi_unregister(struct backing_dev_info *bdi)
wb_shutdown(&bdi->wb);
cgwb_bdi_unregister(bdi);
+ /* if min ratio doesn't 0, it has to set 0 before unregister */
+ if (bdi->min_ratio) {
+ bdi_set_min_ratio(bdi, 0);
+ }
+
if (bdi->dev) {
bdi_debug_unregister(bdi);
device_unregister(bdi->dev);
--
2.32.0
next parent reply other threads:[~2021-10-21 7:23 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20211021072307epcas1p4aa4388c13e71a66e3e1d5f7ee68b5a7f@epcas1p4.samsung.com>
2021-10-21 16:19 ` Manjong Lee [this message]
2021-10-21 11:16 ` [PATCH 1/1] mm: bdi: Initialize bdi_min_ratio when bdi unregister Christoph Hellwig
2021-10-21 12:01 ` Matthew Wilcox
2021-10-22 2:45 ` Andrew Morton
2021-10-22 2:58 ` Matthew Wilcox
[not found] ` <CGME20211022043310epcas1p22952e8fa3eb3675717badae9a3e1223e@epcas1p2.samsung.com>
2021-10-22 13:39 ` Manjong Lee
2021-12-10 21:35 ` Peter Zijlstra
2021-12-10 21:36 ` Peter Zijlstra
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211021161942.5983-1-mj0123.lee@samsung.com \
--to=mj0123.lee@samsung.com \
--cc=akpm@linux-foundation.org \
--cc=jisoo2146.oh@samsung.com \
--cc=junho89.kim@samsung.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=nanich.lee@samsung.com \
--cc=seunghwan.hyun@samsung.com \
--cc=sookwan7.kim@samsung.com \
--cc=yt0928.kim@samsung.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).