Commit efd012db authored by Anton Altaparmakov's avatar Anton Altaparmakov

NTFS: Provide exclusion between opening an inode / mapping an mft record

      and accessing the mft record in fs/ntfs/mft.c::ntfs_mft_writepage()
      by setting the page not uptodate throughout ntfs_mft_writepage().
Signed-off-by: default avatarAnton Altaparmakov <aia21@cantab.net>
parent 3e593cf7
...@@ -82,6 +82,9 @@ ToDo/Notes: ...@@ -82,6 +82,9 @@ ToDo/Notes:
extend the initialized size. extend the initialized size.
- Map the page instead of using page_address() before writing to it in - Map the page instead of using page_address() before writing to it in
fs/ntfs/aops.c::ntfs_mft_writepage(). fs/ntfs/aops.c::ntfs_mft_writepage().
- Provide exclusion between opening an inode / mapping an mft record
and accessing the mft record in fs/ntfs/mft.c::ntfs_mft_writepage()
by setting the page not uptodate throughout ntfs_mft_writepage().
2.1.20 - Fix two stupid bugs introduced in 2.1.18 release. 2.1.20 - Fix two stupid bugs introduced in 2.1.18 release.
......
...@@ -724,18 +724,9 @@ int write_mft_record_nolock(ntfs_inode *ni, MFT_RECORD *m, int sync) ...@@ -724,18 +724,9 @@ int write_mft_record_nolock(ntfs_inode *ni, MFT_RECORD *m, int sync)
*/ */
if (!NInoTestClearDirty(ni)) if (!NInoTestClearDirty(ni))
goto done; goto done;
/* Make sure we have mapped buffers. */ BUG_ON(!page_has_buffers(page));
if (!page_has_buffers(page)) {
no_buffers_err_out:
ntfs_error(vol->sb, "Writing mft records without existing "
"buffers is not implemented yet. %s",
ntfs_please_email);
err = -EOPNOTSUPP;
goto err_out;
}
bh = head = page_buffers(page); bh = head = page_buffers(page);
if (!bh) BUG_ON(!bh);
goto no_buffers_err_out;
nr_bhs = 0; nr_bhs = 0;
block_start = 0; block_start = 0;
m_start = ni->page_ofs; m_start = ni->page_ofs;
...@@ -892,6 +883,12 @@ static int ntfs_mft_writepage(struct page *page, struct writeback_control *wbc) ...@@ -892,6 +883,12 @@ static int ntfs_mft_writepage(struct page *page, struct writeback_control *wbc)
ntfs_debug("Entering for %i inodes starting at 0x%lx.", nr, mft_no); ntfs_debug("Entering for %i inodes starting at 0x%lx.", nr, mft_no);
/* Iterate over the mft records in the page looking for a dirty one. */ /* Iterate over the mft records in the page looking for a dirty one. */
maddr = (u8*)kmap(page); maddr = (u8*)kmap(page);
/*
* Clear the page uptodate flag. This will cause anyone trying to get
* hold of the page to block on the page lock in read_cache_page().
*/
BUG_ON(!PageUptodate(page));
ClearPageUptodate(page);
for (i = 0; i < nr; ++i, ++mft_no, maddr += vol->mft_record_size) { for (i = 0; i < nr; ++i, ++mft_no, maddr += vol->mft_record_size) {
struct inode *vi; struct inode *vi;
ntfs_inode *ni, *eni; ntfs_inode *ni, *eni;
...@@ -1034,6 +1031,7 @@ static int ntfs_mft_writepage(struct page *page, struct writeback_control *wbc) ...@@ -1034,6 +1031,7 @@ static int ntfs_mft_writepage(struct page *page, struct writeback_control *wbc)
up(&ni->extent_lock); up(&ni->extent_lock);
iput(vi); iput(vi);
} }
SetPageUptodate(page);
kunmap(page); kunmap(page);
/* If a dirty mft record was found, redirty the page. */ /* If a dirty mft record was found, redirty the page. */
if (is_dirty) { if (is_dirty) {
......
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