diff options
| author | Baolin Liu <liubaolin@kylinos.cn> | 2026-11-20 23:50:21 +0800 |
|---|---|---|
| committer | Namjae Jeon <linkinjeon@kernel.org> | 2026-11-21 21:05:19 +0900 |
| commit | f8b648c1ace89bb784febaf09cf2d59cc167f840 (patch) | |
| tree | 4fd19e20119bc5e9401dc0cb3880a251016eb70f | |
| parent | 23c62304dde29abe92013d85910d03a77dada35d (diff) | |
ntfs: limit MFT mirror comparisons to system records
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 <liubaolin@kylinos.cn>
Reviewed-by: Hyunchul Lee <hyc.lee@gmail.com>
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
| -rw-r--r-- | fs/ntfs/super.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/fs/ntfs/super.c b/fs/ntfs/super.c index 891b5e0c384b..f38f35434995 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 @@ mft_unmap_out: i); goto mm_unmap_out; } +next_record: kmft += vol->mft_record_size; kmirr += vol->mft_record_size; } while (++i < vol->mftmirr_size); |
