History

mm: bdi: initialize bdi_min_ratio when bdi is unregistered

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]

Manjong Lee committed 4 years ago

Commit 3c376df1 parent 41781581 file · +7 −0Browse files

Unified · Split

mm/backing-dev.c+7−0
@@ -945,6 +945,13 @@ void bdi_unregister(struct backing_dev_info *bdi) · 944 unmodified lines
945945 wb_shutdown(&bdi->wb);
946946 cgwb_bdi_unregister(bdi);
947947
948+ /*
949+ * If this BDI's min ratio has been set, use bdi_set_min_ratio() to
950+ * update the global bdi_min_ratio.
951+ */
952+ if (bdi->min_ratio)
953+ bdi_set_min_ratio(bdi, 0);
954+
948955 if (bdi->dev) {
949956 bdi_debug_unregister(bdi);
950957 device_unregister(bdi->dev);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t