[PATCH 10/26] NTFS 2.1.22 - Bug and race fixes and improved error handling.
From: Anton Altaparmakov
Date: Wed Nov 10 2004 - 08:55:54 EST
This is patch 10/26 in the series. It contains the following ChangeSet:
<aia21@xxxxxxxxxx> (04/10/28 1.2026.1.35)
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: Anton Altaparmakov <aia21@xxxxxxxxxx>
Anton Altaparmakov <aia21 at cam.ac.uk> (replace at with @)
Unix Support, Computing Service, University of Cambridge, CB2 3QH, UK
Linux NTFS maintainer / IRC: #ntfs on irc.freenode.net
WWW: http://linux-ntfs.sf.net/, http://www-stu.christs.cam.ac.uk/~aia21/
diff -Nru a/fs/ntfs/ChangeLog b/fs/ntfs/ChangeLog
--- a/fs/ntfs/ChangeLog 2004-11-10 13:44:52 +00:00
+++ b/fs/ntfs/ChangeLog 2004-11-10 13:44:52 +00:00
@@ -42,6 +42,9 @@
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.
diff -Nru a/fs/ntfs/aops.c b/fs/ntfs/aops.c
--- a/fs/ntfs/aops.c 2004-11-10 13:44:52 +00:00
+++ b/fs/ntfs/aops.c 2004-11-10 13:44:52 +00:00
@@ -1117,7 +1117,8 @@
* 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 @@
/* Is the page fully outside i_size? (truncate in progress) */
if (unlikely(page->index >= (vi->i_size + PAGE_CACHE_SIZE - 1) >>
+ * The page may have dirty, unmapped buffers. Make them
+ * freeable here, so the page does not leak.
+ block_invalidatepage(page, 0);
ntfs_debug("Write outside i_size - truncated?");
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/