The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: DaeMyung Kang <charsyam@gmail.com>
To: Namjae Jeon <linkinjeon@kernel.org>
Cc: Hyunchul Lee <hyc.lee@gmail.com>,
	linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 2/2] ntfs: do not mark the volume clean from sync_fs
Date: Mon, 11 May 2026 02:11:15 +0900	[thread overview]
Message-ID: <20260510171115.368494-3-charsyam@gmail.com> (raw)
In-Reply-To: <20260510171115.368494-1-charsyam@gmail.com>

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@gmail.com>
---
 fs/ntfs/super.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/fs/ntfs/super.c b/fs/ntfs/super.c
index e8ecc52..024d363 100644
--- a/fs/ntfs/super.c
+++ b/fs/ntfs/super.c
@@ -1895,7 +1895,6 @@ static void ntfs_shutdown(struct super_block *sb)
 static int ntfs_sync_fs(struct super_block *sb, int wait)
 {
 	struct ntfs_volume *vol = NTFS_SB(sb);
-	int err = 0;
 
 	if (NVolShutdown(vol))
 		return -EIO;
@@ -1903,15 +1902,10 @@ static int ntfs_sync_fs(struct super_block *sb, int wait)
 	if (!wait)
 		return 0;
 
-	/* If there are some dirty buffers in the bdev inode */
-	if (ntfs_clear_volume_flags(vol, VOLUME_IS_DIRTY)) {
-		ntfs_warning(sb, "Failed to clear dirty bit in volume information flags.  Run chkdsk.");
-		err = -EIO;
-	}
 	sync_inodes_sb(sb);
 	sync_blockdev(sb->s_bdev);
 	blkdev_issue_flush(sb->s_bdev);
-	return err;
+	return 0;
 }
 
 /*
-- 
2.43.0


  parent reply	other threads:[~2026-05-10 17:11 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-10 17:11 [PATCH 0/2] ntfs: super.c fixes for MFT mirror check and sync_fs DaeMyung Kang
2026-05-10 17:11 ` [PATCH 1/2] ntfs: restore $MFT mirror contents check DaeMyung Kang
2026-05-11 14:31   ` Namjae Jeon
2026-05-10 17:11 ` DaeMyung Kang [this message]
2026-05-11  2:58   ` [PATCH 2/2] ntfs: do not mark the volume clean from sync_fs Namjae Jeon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260510171115.368494-3-charsyam@gmail.com \
    --to=charsyam@gmail.com \
    --cc=hyc.lee@gmail.com \
    --cc=linkinjeon@kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox