- reiserfs_write_full_page-should-not-get_block-past-eof.patch removed from -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled

     reiserfs_write_full_page() should not get_block past eof

has been removed from the -mm tree.  Its filename is

     reiserfs_write_full_page-should-not-get_block-past-eof.patch

This patch was dropped because it was merged into mainline or a subsystem tree

------------------------------------------------------
Subject: reiserfs_write_full_page() should not get_block past eof
From: Chris Mason <mason@xxxxxxxx>

reiserfs_write_full_page does zero bytes in the file past eof, but it may
call get_block on those buffers as well.  On machines where the page size
is larger than the blocksize, this can result in mmaped files incorrectly
growing up to a block boundary during writepage.

The fix is to avoid calling get_block for any blocks that are entirely past
eof

Signed-off-by: Chris Mason <mason@xxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxx>
---

 fs/reiserfs/inode.c |   14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff -puN fs/reiserfs/inode.c~reiserfs_write_full_page-should-not-get_block-past-eof fs/reiserfs/inode.c
--- a/fs/reiserfs/inode.c~reiserfs_write_full_page-should-not-get_block-past-eof
+++ a/fs/reiserfs/inode.c
@@ -2340,6 +2340,7 @@ static int reiserfs_write_full_page(stru
 	unsigned long end_index = inode->i_size >> PAGE_CACHE_SHIFT;
 	int error = 0;
 	unsigned long block;
+	sector_t last_block;
 	struct buffer_head *head, *bh;
 	int partial = 0;
 	int nr = 0;
@@ -2387,10 +2388,19 @@ static int reiserfs_write_full_page(stru
 	}
 	bh = head;
 	block = page->index << (PAGE_CACHE_SHIFT - s->s_blocksize_bits);
+	last_block = (i_size_read(inode) - 1) >> inode->i_blkbits;
 	/* first map all the buffers, logging any direct items we find */
 	do {
-		if ((checked || buffer_dirty(bh)) && (!buffer_mapped(bh) ||
-						      (buffer_mapped(bh)
+		if (block > last_block) {
+			/*
+			 * This can happen when the block size is less than
+			 * the page size.  The corresponding bytes in the page
+			 * were zero filled above
+			 */
+			clear_buffer_dirty(bh);
+			set_buffer_uptodate(bh);
+		} else if ((checked || buffer_dirty(bh)) &&
+		           (!buffer_mapped(bh) || (buffer_mapped(bh)
 						       && bh->b_blocknr ==
 						       0))) {
 			/* not mapped yet, or it points to a direct item, search
_

Patches currently in -mm which might be from mason@xxxxxxxx are

reiserfs-warn-about-the-useless-nolargeio-option.patch
make-reiserfs-default-to-barrier=flush.patch
make-ext3-mount-default-to-barrier=1.patch
reiserfs_fsync-should-only-use-barriers-when-they-are-enabled.patch
fix-reiserfs-latencies-caused-by-data=ordered.patch

-
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Kernel Newbies FAQ]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Photo]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux