Skip to content

Commit e74589a

Browse files
NTFS: Fix bug in mft record writing where we forgot to set the device in
the buffers when mapping them after the VM had discarded them. Thanks to Martin MOKREJŠ for the bug report. Signed-off-by: Anton Altaparmakov <aia21@cantab.net>
1 parent 3edea48 commit e74589a

2 files changed

Lines changed: 5 additions & 0 deletions

File tree

‎fs/ntfs/ChangeLog‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,9 @@ ToDo/Notes:
174174
fact that the vfs and ntfs inodes are one struct in memory to find
175175
the ntfs inode in memory if present. Also, the ntfs inode has its
176176
own locking so it does not matter if the vfs inode is locked.
177+
- Fix bug in mft record writing where we forgot to set the device in
178+
the buffers when mapping them after the VM had discarded them
179+
Thanks to Martin MOKREJŠ for the bug report.
177180

178181
2.1.22 - Many bug and race fixes and error handling improvements.
179182

‎fs/ntfs/mft.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -533,6 +533,7 @@ int ntfs_sync_mft_mirror(ntfs_volume *vol, const unsigned long mft_no,
533533
LCN lcn;
534534
unsigned int vcn_ofs;
535535

536+
bh->b_bdev = vol->sb->s_bdev;
536537
/* Obtain the vcn and offset of the current block. */
537538
vcn = ((VCN)mft_no << vol->mft_record_size_bits) +
538539
(block_start - m_start);
@@ -725,6 +726,7 @@ int write_mft_record_nolock(ntfs_inode *ni, MFT_RECORD *m, int sync)
725726
LCN lcn;
726727
unsigned int vcn_ofs;
727728

729+
bh->b_bdev = vol->sb->s_bdev;
728730
/* Obtain the vcn and offset of the current block. */
729731
vcn = ((VCN)ni->mft_no << vol->mft_record_size_bits) +
730732
(block_start - m_start);

0 commit comments

Comments
 (0)