hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/fs/fs-writeback.c
....@@ -700,7 +700,7 @@
700700 * is okay. The main goal is avoiding keeping an inode on
701701 * the wrong wb for an extended period of time.
702702 */
703
- if (hweight32(history) > WB_FRN_HIST_THR_SLOTS)
703
+ if (hweight16(history) > WB_FRN_HIST_THR_SLOTS)
704704 inode_switch_wbs(inode, max_id);
705705 }
706706
....@@ -884,6 +884,16 @@
884884 continue;
885885 }
886886
887
+ /*
888
+ * If wb_tryget fails, the wb has been shutdown, skip it.
889
+ *
890
+ * Pin @wb so that it stays on @bdi->wb_list. This allows
891
+ * continuing iteration from @wb after dropping and
892
+ * regrabbing rcu read lock.
893
+ */
894
+ if (!wb_tryget(wb))
895
+ continue;
896
+
887897 /* alloc failed, execute synchronously using on-stack fallback */
888898 work = &fallback_work;
889899 *work = *base_work;
....@@ -892,13 +902,6 @@
892902 work->done = &fallback_work_done;
893903
894904 wb_queue_work(wb, work);
895
-
896
- /*
897
- * Pin @wb so that it stays on @bdi->wb_list. This allows
898
- * continuing iteration from @wb after dropping and
899
- * regrabbing rcu read lock.
900
- */
901
- wb_get(wb);
902905 last_wb = wb;
903906
904907 rcu_read_unlock();