Re: [syzbot] [nilfs?] WARNING: ODEBUG bug in nilfs_detach_log_writer (2)

From: Edward Adam Davis

Date: Tue Oct 28 2025 - 01:20:13 EST


#syz test

diff --git a/fs/nilfs2/segment.c b/fs/nilfs2/segment.c
index f15ca6fc400d..8a17ae49bc41 100644
--- a/fs/nilfs2/segment.c
+++ b/fs/nilfs2/segment.c
@@ -2768,7 +2768,9 @@ static void nilfs_segctor_destroy(struct nilfs_sc_info *sci)

if (sci->sc_task) {
wake_up(&sci->sc_wait_daemon);
- kthread_stop(sci->sc_task);
+ printk("kthread start to stop (sci %p)sctask %p, %s\n", sci, sci->sc_task, __func__);
+ int ret = kthread_stop(sci->sc_task);
+ printk("kthread stopped (sci %p)sctask %p thread return %d, %s\n", sci, sci->sc_task, ret, __func__);
}

spin_lock(&sci->sc_state_lock);
@@ -2808,6 +2810,10 @@ static void nilfs_segctor_destroy(struct nilfs_sc_info *sci)

down_write(&nilfs->ns_segctor_sem);

+ if (sci->sc_task) {
+ printk("sci %p sctask %p %s\n", sci, sci->sc_task, __func__);
+ //timer_shutdown_sync(&sci->sc_timer);
+ }
kfree(sci);
}