Commit 551f668f authored by Anton Altaparmakov's avatar Anton Altaparmakov

NTFS: - Fix creation of buffers in fs/ntfs/mft.c::ntfs_sync_mft_mirror().

        Cannot just call fs/ntfs/aops.c::mark_ntfs_record_dirty() since
        this also marks the page dirty so we create the buffers by hand
        and set them uptodate.
      - Revert the removal of the page uptodate check from
        fs/ntfs/aops.c::mark_ntfs_record_dirty() as it is no longer called
        from fs/ntfs/mft.c::ntfs_sync_mft_mirror().
Signed-off-by: default avatarAnton Altaparmakov <aia21@cantab.net>
parent 0f9bfc48
......@@ -89,9 +89,6 @@ ToDo/Notes:
and write_mft_record_nolock(). From now on we require that the
complete runlist for the mft mirror is always mapped into memory.
- Add creation of buffers to fs/ntfs/mft.c::ntfs_sync_mft_mirror().
- Do not check for the page being uptodate in mark_ntfs_record_dirty()
as we now call this after marking the page not uptodate during mft
mirror synchronisation (fs/ntfs/mft.c::ntfs_sync_mft_mirror()).
- Improve error handling in fs/ntfs/aops.c::ntfs_{read,write}_block().
2.1.21 - Fix some races and bugs, rewrite mft write code, add mft allocator.
......
......@@ -819,6 +819,12 @@ static int ntfs_write_mst_block(struct page *page,
BUG_ON(!NInoNonResident(ni));
BUG_ON(!NInoMstProtected(ni));
is_mft = (S_ISREG(vi->i_mode) && !vi->i_ino);
/*
* NOTE: ntfs_write_mst_block() would be called for $MFTMirr if a page
* in its page cache were to be marked dirty. However this should
* never happen with the current driver and considering we do not
* handle this case here we do want to BUG(), at least for now.
*/
BUG_ON(!(is_mft || S_ISDIR(vi->i_mode) ||
(NInoAttr(ni) && ni->type == AT_INDEX_ALLOCATION)));
BUG_ON(!max_bhs);
......@@ -2282,6 +2288,7 @@ void mark_ntfs_record_dirty(struct page *page, const unsigned int ofs) {
struct buffer_head *bh, *head, *buffers_to_free = NULL;
unsigned int end, bh_size, bh_ofs;
BUG_ON(!PageUptodate(page));
end = ofs + ni->itype.index.block_size;
bh_size = 1 << VFS_I(ni)->i_blkbits;
spin_lock(&mapping->private_lock);
......
......@@ -497,12 +497,20 @@ int ntfs_sync_mft_mirror(ntfs_volume *vol, const unsigned long mft_no,
kmirr = page_address(page) + page_ofs;
/* Copy the mst protected mft record to the mirror. */
memcpy(kmirr, m, vol->mft_record_size);
/*
* Create buffers if not present and mark the ones belonging to the mft
* mirror record dirty.
*/
mark_ntfs_record_dirty(page, page_ofs);
/* Create uptodate buffers if not present. */
if (unlikely(!page_has_buffers(page))) {
struct buffer_head *tail;
bh = head = alloc_page_buffers(page, blocksize, 1);
do {
set_buffer_uptodate(bh);
tail = bh;
bh = bh->b_this_page;
} while (bh);
tail->b_this_page = head;
attach_page_buffers(page, head);
BUG_ON(!page_has_buffers(page));
}
bh = head = page_buffers(page);
BUG_ON(!bh);
rl = NULL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment