[PATCH 2/3] exfat: keep the volume marked dirty after a shutdown

Christian Brauner brauner at kernel.org
Mon Nov 16 01:28:31 PST 2026


After a shutdown exfat_write_inode() and exfat_writepages() drop
whatever is still dirty. But exfat_put_super() and a remount to
read-only still clear VOLUME_DIRTY through exfat_set_vol_flags() which
only leaves the boot sector alone on a read-only superblock. So after a
shutdown with EXFAT_GOING_DOWN_NOSYNC the volume ends up marked clean
although it may be inconsistent. Leave the boot sector alone after a
shutdown too.

Fixes: f761fcdd289d ("exfat: Implement sops->shutdown and ioctl")
Cc: stable at vger.kernel.org
Signed-off-by: Christian Brauner (Amutable) <brauner at kernel.org>
---
 fs/exfat/super.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/exfat/super.c b/fs/exfat/super.c
index 4943cef977418..eef7c159d32f4 100644
--- a/fs/exfat/super.c
+++ b/fs/exfat/super.c
@@ -98,8 +98,9 @@ static int exfat_set_vol_flags(struct super_block *sb, unsigned short new_flags)
 
 	/* skip updating volume dirty flag,
 	 * if this volume has been mounted with read-only
+	 * or was shut down (it stays dirty then)
 	 */
-	if (sb_rdonly(sb))
+	if (sb_rdonly(sb) || exfat_forced_shutdown(sb))
 		return 0;
 
 	p_boot->vol_flags = cpu_to_le16(new_flags);

-- 
2.53.0




More information about the linux-mtd mailing list