Skip to content

Commit 2beaa98

Browse files
charsyamnamjaejeon
authored andcommitted
ntfs: restore $MFT mirror contents check
check_mft_mirror() still computes the number of bytes to validate in each mirrored MFT record, but the actual comparison against $MFTMirr was dropped when the superblock code was updated. As a result, mount misses a stale or inconsistent $MFTMirr as long as both records pass the structural baad-record checks. Restore the comparison and log an error when the primary $MFT record differs from its mirror copy. Returning false lets the existing mount error handling mark the volume as having NTFS errors and, with on_errors=remount-ro, continue read-only. The default on_errors=continue mount policy still allows the mount to proceed. Fixes: 6251f0b ("ntfs: update super block operations") Signed-off-by: DaeMyung Kang <charsyam@gmail.com> Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
1 parent 8c16c1c commit 2beaa98

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

fs/ntfs/super.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -993,6 +993,13 @@ static bool check_mft_mirror(struct ntfs_volume *vol)
993993
ntfs_is_baad_recordp((__le32 *)kmirr))
994994
bytes = vol->mft_record_size;
995995
}
996+
/* Compare the two records. */
997+
if (memcmp(kmft, kmirr, bytes)) {
998+
ntfs_error(sb,
999+
"$MFT and $MFTMirr record %i do not match. Run chkdsk.",
1000+
i);
1001+
goto mm_unmap_out;
1002+
}
9961003
kmft += vol->mft_record_size;
9971004
kmirr += vol->mft_record_size;
9981005
} while (++i < vol->mftmirr_size);

0 commit comments

Comments
 (0)