Re: [PATCH v5 04/12] f2fs: cache: introduce writeback thread

From: Wenjie Qi

Date: Wed Sep 02 2026 - 08:22:12 EST


Hi Chao,

> if (flags & SB_RDONLY) {
> if (sbi->cache_thread.cache_wb_task) {
> f2fs_stop_cache_wb_thread(sbi);
> need_restart_wb = true;
> }
> }

and later:

> err = f2fs_sync_fs(sb, 1);
> if (err)
> goto restore_gc;

The writeback rollback begins at:

> restore_wb:

and the GC rollback begins later at:

> restore_gc:

The common option rollback then contains:

> restore_opts:
> sbi->mount_opt = org_mount_opt;
> sb->s_flags = old_sb_flags;

The RW-to-RO path stops `cache_wb_task` and sets `need_restart_wb`, but
the sync error jumps directly to `restore_gc`. Since `restore_wb` precedes
`restore_gc`, this edge does not execute the writeback-thread rollback before
the old mount options and flags are restored.