Commit d5f47dbd authored by Anton Altaparmakov's avatar Anton Altaparmakov

NTFS: In fs/ntfs/aops.c::ntfs_writepage(), if t he page is fully outside

      i_size, i.e. race with truncate, invalidate the buffers on the page
      so that they become freeable and hence the page does not leak.
Signed-off-by: default avatarAnton Altaparmakov <aia21@cantab.net>
parent baf0042f
......@@ -42,6 +42,9 @@ ToDo/Notes:
mount time as this cannot work with the current implementation.
- Check for location of attribute name and improve error handling in
general in fs/ntfs/inode.c::ntfs_read_locked_inode() and friends.
- In fs/ntfs/aops.c::ntfs_writepage(), if t he page is fully outside
i_size, i.e. race with truncate, invalidate the buffers on the page
so that they become freeable and hence the page does not leak.
2.1.21 - Fix some races and bugs, rewrite mft write code, add mft allocator.
......
......@@ -1117,7 +1117,8 @@ static int ntfs_write_mst_block(struct writeback_control *wbc,
* For resident attributes, OTOH, ntfs_writepage() writes the @page by copying
* the data to the mft record (which at this stage is most likely in memory).
* The mft record is then marked dirty and written out asynchronously via the
* vfs inode dirty code path.
* vfs inode dirty code path for the inode the mft record belongs to or via the
* vm page dirty code path for the page the mft record is in.
*
* Based on ntfs_readpage() and fs/buffer.c::block_write_full_page().
*
......@@ -1141,6 +1142,11 @@ static int ntfs_writepage(struct page *page, struct writeback_control *wbc)
/* Is the page fully outside i_size? (truncate in progress) */
if (unlikely(page->index >= (vi->i_size + PAGE_CACHE_SIZE - 1) >>
PAGE_CACHE_SHIFT)) {
/*
* The page may have dirty, unmapped buffers. Make them
* freeable here, so the page does not leak.
*/
block_invalidatepage(page, 0);
unlock_page(page);
ntfs_debug("Write outside i_size - truncated?");
return 0;
......
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