Re: [PATCH 2/2] ntfs: do not mark the volume clean from sync_fs
From: Namjae Jeon
Date: Sun May 10 2026 - 22:58:56 EST
On Mon, May 11, 2026 at 2:11 AM DaeMyung Kang <charsyam@xxxxxxxxx> wrote:
>
> ntfs_sync_fs() can be called while the filesystem remains mounted
> read-write, for example by sync(2) or periodic writeback. Clearing
> VOLUME_IS_DIRTY from that path marks the volume clean before the mount
> lifetime has ended.
>
> If the system crashes after sync_fs() clears the bit but before unmount or
> remount-read-only, the volume can be left looking clean even though a clean
> shutdown did not happen. Keep the dirty bit set during sync_fs(); the
> unmount and remount-read-only paths already clear it when no NTFS errors
> were seen.
>
> Fixes: 6251f0b0de7d ("ntfs: update super block operations")
> Signed-off-by: DaeMyung Kang <charsyam@xxxxxxxxx>
The VOLUME_IS_DIRTY flag is set just before write operations. Once
those changes are safely flushed to disk, I think that it should be
reasonable to clear the dirty bit. That said, because many users
generally tend to simply unplug USB drives without unmounting,
clearing it only in the unmount paths causes unnecessary warnings and
chkdsk suggestions on the next mount, even when there is no actual
corruption.
Thanks.