Re: [PATCH v2] exfat: drain dirty pages after forced shutdown

From: Namjae Jeon

Date: Tue Oct 27 2026 - 05:54:21 EST


On Tue, Oct 27, 2026 at 2:47 PM Chi Zhiling <chizhiling@xxxxxxx> wrote:
>
> From: Chi Zhiling <chizhiling@xxxxxxxxxx>
>
> A forced shutdown sets EXFAT_FLAGS_SHUTDOWN, after which
> exfat_writepages() returns -EIO. Pages dirtied before the shutdown can
> then never be written back, so a writer throttled in
> balance_dirty_pages() while extending valid_size sleeps forever.
>
> Stuck stack:
> balance_dirty_pages+0x4f0/0xb40
> exfat_prepare_valid_range+0x43/0x140
> exfat_file_write_iter+0x413/0x520
> iter_file_splice_write+0x32d/0x5a0
> direct_splice_actor+0x51/0x270
> splice_direct_to_actor+0xf5/0x270
> do_splice_direct+0x76/0xc0
> vfs_copy_file_range+0x244/0x710
> __do_sys_copy_file_range+0xe6/0x240
> do_syscall_64+0x106/0x5f0
> entry_SYSCALL_64_after_hwframe+0x77/0x7f
>
> Do not reject writeback up front. Reject it per folio from
> ->writeback_range() instead: iomap then ends writeback and clears the
> dirty state without issuing I/O, which lets the dirty limits drain and
> unblocks the writer.
>
> Write syscalls and page faults are still rejected in
> exfat_file_write_iter() and exfat_page_mkwrite(). A write that is
> already in progress may continue to dirty folios; writeback retires
> them without I/O as described above.
>
> Fixes: f761fcdd289d0 ("exfat: Implement sops->shutdown and ioctl")
> Signed-off-by: Chi Zhiling <chizhiling@xxxxxxxxxx>
Applied it to #dev.
Thanks!