ntfs: use base mft_no when looking up base inode for extent record
Subsystems (2)
PATCH 1/1 ntfs: use base mft_no when looking up base inode for extent record
When the mft record is an extent record, ntfs_may_write_mft_record() looks up its base inode in the icache. The hash key passed to find_inode_nowait() must be the base inode's mft number (na.mft_no, set just above to MREF_LE(m->base_mft_record)), but the code passes @mft_no, the extent record's own number.
find_inode_nowait() uses its second argument as the hashval, so the lookup lands in the wrong bucket and almost always returns NULL. ntfs_may_write_mft_record() then returns false and the writeback path (ntfs_write_mft_block()) skips that extent record, leaving the on-disk copy permanently out of sync with the in-memory one.
The original ilookup5_nowait() call this conversion replaced used na.mft_no. Restore that.
--- fs/ntfs/mft.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ntfs/mft.c +1 -1
@@ -833,7 +833,7 @@ static bool ntfs_may_write_mft_record(struct ntfs_volume *vol, const u64 mft_no, vi =igrab (mft_vi);WARN_ON (vi != mft_vi); }else { - vi =find_inode_nowait (sb, mft_no, ntfs_test_inode_wb, &na); + vi =find_inode_nowait (sb, na.mft_no, ntfs_test_inode_wb, &na);if (na.state == NI_BeingDeleted || na.state == NI_BeingCreated)return false; }
Signature · 1 line
2.43.0
2026년 4월 30일 (목) 오후 8:54, DaeMyung Kang <[email protected]>님이 작성:
Quoted 13 lines
When the mft record is an extent record,
ntfs_may_write_mft_record()looks up its base inode in the icache. The hash key passed tofind_inode_nowait()must be the base inode's mft number (na.mft_no, set just above toMREF_LE(m->base_mft_record)), but the code passes @mft_no, the extent record's own number.
find_inode_nowait()uses its second argument as the hashval, so the lookup lands in the wrong bucket and almost always returns NULL.ntfs_may_write_mft_record()then returns false and the writeback path (ntfs_write_mft_block()) skips that extent record, leaving the on-disk copy permanently out of sync with the in-memory one.
Quoted 5 lines
The original
ilookup5_nowait()call this conversion replaced used na.mft_no. Restore that.Fixes 115380f9a2f9 ("ntfs: update mft operations")Signed-off-by DaeMyung Kang <[email protected]>
Looks good to me.
Quoted 18 lines
--- fs/ntfs/mft.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)fs/ntfs/mft.c +1
-2@@ -833,7 +833,7 @@ static bool ntfs_may_write_mft_record(struct ntfs_volume *vol, const u64 mft_no, vi =igrab (mft_vi);WARN_ON (vi != mft_vi); }else { - vi =find_inode_nowait (sb, mft_no, ntfs_test_inode_wb, &na); + vi =find_inode_nowait (sb, na.mft_no, ntfs_test_inode_wb, &na);if (na.state == NI_BeingDeleted || na.state == NI_BeingCreated)return false; } --
Quoted 2 lines
2.43.0
--
Thanks,
Hyunchul
Quoted 13 lines · DaeMyung Kang
When the mft record is an extent record,
ntfs_may_write_mft_record()looks up its base inode in the icache. The hash key passed tofind_inode_nowait()must be the base inode's mft number (na.mft_no, set just above toMREF_LE(m->base_mft_record)), but the code passes @mft_no, the extent record's own number.
find_inode_nowait()uses its second argument as the hashval, so the lookup lands in the wrong bucket and almost always returns NULL.ntfs_may_write_mft_record()then returns false and the writeback path (ntfs_write_mft_block()) skips that extent record, leaving the on-disk copy permanently out of sync with the in-memory one.
Quoted 5 lines
The original
ilookup5_nowait()call this conversion replaced used na.mft_no. Restore that.Fixes 115380f9a2f9 ("ntfs: update mft operations")Signed-off-by DaeMyung Kang <[email protected]>
Applied it to #ntfs-next
Thanks!