fs/ntfs3: load ATTR_BITMAP run extents from $MFT extension records
Konstantin Komarov
maintainerQuoted 47 lines · Senjin
When $MFT's
ATTR_BITMAPattribute is heavily fragmented, its run list can span multiple MFT extension records (attribute list entries with vcn > 0). The non-primary segment handler inntfs_read_mft()only processedATTR_DATAextension segments forMFT_REC_MFT, silently skipping anyATTR_BITMAPsegments. This leftsbi->mft.bitmap.runincomplete, causingwnd_init()to fail with-ENOENTwhenwnd_rescan()tried to look up a VCN not covered by the truncated run list.Observed on a 16 TB NTFS volume (
0xFFFFFEFFtotal clusters) whose MFT bitmap run list was split across 97 extents in extension records.wnd_rescan()successfully looked up VCNs 0-122 from the runs loaded from the base record, then failed at VCN 123 (the last cluster of the bitmap) whose run was only present in an extension record.Fix by extending the
MFT_REC_MFTspecial case to also handleATTR_BITMAPextension segments, storing their runs intosbi->mft.bitmap.runthe same way the primary segment does.Signed-off-by Senjin <[email protected]>--- fs/ntfs3/inode.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)fs/ntfs3/inode.c +8
-3@@ -128,11 +128,16 @@ static struct inode *ntfs_read_mft(struct inode *inode,if (le && le->vcn) {/* This is non primary attribute segment. Ignore if not MFT. */ -if (ino !=MFT_REC_MFT || attr->type !=ATTR_DATA ) +if (ino !=MFT_REC_MFT ) goto next_attr; - run = &ni->file.run; +if (attr->type ==ATTR_DATA ) + run = &ni->file.run; +else if (attr->type ==ATTR_BITMAP ) + run = &sbi->mft.bitmap.run; +else + goto next_attr; + asize =le32_to_cpu (attr->size); goto attr_unpack_run; } --
Quoted 1 line
2.x
Hello,
Very sorry for the delay.
Your patch is applied, thanks.
Regards,
Konstantin