aboutsummaryrefslogtreecommitdiffstats
path: root/fs/fs-writeback.c
diff options
context:
space:
mode:
authorJakub Kicinski <[email protected]>2023-04-20 23:27:33 +0000
committerJakub Kicinski <[email protected]>2023-04-20 23:29:51 +0000
commit681c5b51dc6b8ff1ec05555243eccf64a08cb2fd (patch)
tree713e0523bc617cbda9ff930568dd2341907b87b8 /fs/fs-writeback.c
parentnet: libwx: fix memory leak in wx_setup_rx_resources (diff)
parentwifi: ath9k: Don't mark channelmap stack variable read-only in ath9k_mci_upda... (diff)
downloadkernel-681c5b51dc6b8ff1ec05555243eccf64a08cb2fd.tar.gz
kernel-681c5b51dc6b8ff1ec05555243eccf64a08cb2fd.zip
Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net
Adjacent changes: net/mptcp/protocol.h 63740448a32e ("mptcp: fix accept vs worker race") 2a6a870e44dd ("mptcp: stops worker on unaccepted sockets at listener close") ddb1a072f858 ("mptcp: move first subflow allocation at mpc access time") Signed-off-by: Jakub Kicinski <[email protected]>
Diffstat (limited to 'fs/fs-writeback.c')
-rw-r--r--fs/fs-writeback.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c
index 195dc23e0d83..1db3e3c24b43 100644
--- a/fs/fs-writeback.c
+++ b/fs/fs-writeback.c
@@ -978,6 +978,16 @@ restart:
continue;
}
+ /*
+ * If wb_tryget fails, the wb has been shutdown, skip it.
+ *
+ * Pin @wb so that it stays on @bdi->wb_list. This allows
+ * continuing iteration from @wb after dropping and
+ * regrabbing rcu read lock.
+ */
+ if (!wb_tryget(wb))
+ continue;
+
/* alloc failed, execute synchronously using on-stack fallback */
work = &fallback_work;
*work = *base_work;
@@ -986,13 +996,6 @@ restart:
work->done = &fallback_work_done;
wb_queue_work(wb, work);
-
- /*
- * Pin @wb so that it stays on @bdi->wb_list. This allows
- * continuing iteration from @wb after dropping and
- * regrabbing rcu read lock.
- */
- wb_get(wb);
last_wb = wb;
rcu_read_unlock();