From: Baolin Liu Windows 10 can leave $MFTMirr records from record 16 onwards stale on volumes with large clusters. Comparing them can falsely report corruption. Commit 749357bd48c1 ("ntfs: mount hibernated volumes read-only regardless of errors=") made these mismatches force a read-only mount even with errors=continue. Limit the record checks and comparison to the first 16 records within the mirror, following ntfs-3g. Keep reading the full mirror for runlist mapping and location checks, and leave mirror writeback unchanged. Fixes: 2beaa98b46c4 ("ntfs: restore $MFT mirror contents check") Cc: stable@vger.kernel.org Link: https://github.com/tuxera/ntfs-3g/commit/85e208176ffd16ce9a51a9f534b194f0ebbde6e3 Signed-off-by: Baolin Liu --- fs/ntfs/super.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/fs/ntfs/super.c b/fs/ntfs/super.c index 98e6449fd79f..103d2b1b630b 100644 --- a/fs/ntfs/super.c +++ b/fs/ntfs/super.c @@ -1207,6 +1207,14 @@ static bool check_mft_mirror(struct ntfs_volume *vol) ++index; } + /* + * Windows 10 may leave mirror records beyond the system files + * stale. Read the full mirror to map its runlist, but only + * compare the system records, as ntfs-3g does. + */ + if (i >= FILE_first_user) + goto next_record; + /* Do not check the record if it is not in use. */ if (((struct mft_record *)kmft)->flags & MFT_RECORD_IN_USE) { /* Make sure the record is ok. */ @@ -1250,6 +1258,7 @@ static bool check_mft_mirror(struct ntfs_volume *vol) i); goto mm_unmap_out; } +next_record: kmft += vol->mft_record_size; kmirr += vol->mft_record_size; } while (++i < vol->mftmirr_size); base-commit: 4862a81576e3b20ba40cb94a38c5df0450047ffe