]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
4.9-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 12 Dec 2021 12:16:26 +0000 (13:16 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 12 Dec 2021 12:16:26 +0000 (13:16 +0100)
added patches:
mm-bdi-initialize-bdi_min_ratio-when-bdi-is-unregistered.patch

queue-4.9/mm-bdi-initialize-bdi_min_ratio-when-bdi-is-unregistered.patch [new file with mode: 0644]
queue-4.9/series

diff --git a/queue-4.9/mm-bdi-initialize-bdi_min_ratio-when-bdi-is-unregistered.patch b/queue-4.9/mm-bdi-initialize-bdi_min_ratio-when-bdi-is-unregistered.patch
new file mode 100644 (file)
index 0000000..90f314c
--- /dev/null
@@ -0,0 +1,61 @@
+From 3c376dfafbf7a8ea0dea212d095ddd83e93280bb Mon Sep 17 00:00:00 2001
+From: Manjong Lee <mj0123.lee@samsung.com>
+Date: Fri, 10 Dec 2021 14:47:11 -0800
+Subject: mm: bdi: initialize bdi_min_ratio when bdi is unregistered
+
+From: Manjong Lee <mj0123.lee@samsung.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@linux-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@samsung.com>
+Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
+Cc: Changheun Lee <nanich.lee@samsung.com>
+Cc: Jens Axboe <axboe@kernel.dk>
+Cc: Christoph Hellwig <hch@infradead.org>
+Cc: Matthew Wilcox <willy@infradead.org>
+Cc: <seunghwan.hyun@samsung.com>
+Cc: <sookwan7.kim@samsung.com>
+Cc: <yt0928.kim@samsung.com>
+Cc: <junho89.kim@samsung.com>
+Cc: <jisoo2146.oh@samsung.com>
+Cc: <stable@vger.kernel.org>
+Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.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);
index 70be2f00a96e83c2793d89a3ffdf841f2245761e..9fb5c3ac8f96ad9a5bec73bccfbfbc65d073158b 100644 (file)
@@ -8,3 +8,4 @@ hid-check-for-valid-usb-device-for-many-hid-drivers.patch
 can-sja1000-fix-use-after-free-in-ems_pcmcia_add_card.patch
 nfc-fix-potential-null-pointer-deref-in-nfc_genl_dump_ses_done.patch
 ib-hfi1-correct-guard-on-eager-buffer-deallocation.patch
+mm-bdi-initialize-bdi_min_ratio-when-bdi-is-unregistered.patch