Commit 2beaa98b authored by DaeMyung Kang's avatar DaeMyung Kang Committed by Namjae Jeon
Browse files

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: 6251f0b0 ("ntfs: update super block operations")
Signed-off-by: default avatarDaeMyung Kang <charsyam@gmail.com>
Signed-off-by: default avatarNamjae Jeon <linkinjeon@kernel.org>
parent 8c16c1c0
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -993,6 +993,13 @@ static bool check_mft_mirror(struct ntfs_volume *vol)
			    ntfs_is_baad_recordp((__le32 *)kmirr))
				bytes = vol->mft_record_size;
		}
		/* Compare the two records. */
		if (memcmp(kmft, kmirr, bytes)) {
			ntfs_error(sb,
				   "$MFT and $MFTMirr record %i do not match.  Run chkdsk.",
				   i);
			goto mm_unmap_out;
		}
		kmft += vol->mft_record_size;
		kmirr += vol->mft_record_size;
	} while (++i < vol->mftmirr_size);