Re: [syzbot] [jfs?] INFO: task hung in txBegin

Edward Adam Davis
2024-08-05T12:12:26Z

with sb rwsem lock to order syncfs and wb worker

#syz test: upstream 50736169ecc8

diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c
index b865a3fa52f3..682c5a237edc 100644
--- a/fs/fs-writeback.c
+++ b/fs/fs-writeback.c
@@ -985,6 +985,7 @@ static void bdi_split_work_to_wbs(struct backing_dev_info *bdi,
struct bdi_writeback *last_wb = NULL;
struct bdi_writeback *wb = list_entry(&bdi->wb_list,
struct bdi_writeback, bdi_node);
+ bool no_queue = true;

might_sleep();
restart:
@@ -1015,6 +1016,7 @@ static void bdi_split_work_to_wbs(struct backing_dev_info *bdi,
*work = *base_work;
work->nr_pages = nr_pages;
work->auto_free = 1;
+ no_queue = false;
wb_queue_work(wb, work);
continue;
}
@@ -1043,6 +1045,12 @@ static void bdi_split_work_to_wbs(struct backing_dev_info *bdi,
wb_wait_for_completion(&fallback_work_done);
goto restart;
}
+
+ if (no_queue) {
+ printk("no queue\n");
+ base_work->auto_free = 1;
+ finish_writeback_work(base_work);
+ }
rcu_read_unlock();

if (last_wb)