rpms/kernel/F-11 linux-2.6-ext4-prealloc-fixes.patch, NONE, 1.1 kernel.spec, 1.1581, 1.1582

Eric Sandeen sandeen at fedoraproject.org
Fri May 1 19:00:04 UTC 2009


Author: sandeen

Update of /cvs/pkgs/rpms/kernel/F-11
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv23430

Modified Files:
	kernel.spec 
Added Files:
	linux-2.6-ext4-prealloc-fixes.patch 
Log Message:
* Fri May 01 2009 Eric Sandeen <sandeen at redhat.com>
- Fix ext4 corruption on partial write into prealloc block


linux-2.6-ext4-prealloc-fixes.patch:

--- NEW FILE linux-2.6-ext4-prealloc-fixes.patch ---
We need to mark the  buffer_head mapping prealloc space
as new during write_begin. Otherwise we don't zero out the
page cache content properly for a partial write. This will
cause file corruption with preallocation.

Also use block number -1 as the fake block number so that
unmap_underlying_metadata doesn't drop wrong buffer_head

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar at linux.vnet.ibm.com>

Block number '0' should not be used as the fake block number for
the delayed new buffer. This will result in vfs calling umap_underlying_metadata for
block number '0'. So  use -1 instead.

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar at linux.vnet.ibm.com>

---
 fs/ext4/inode.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Index: linux-2.6.29.noarch/fs/ext4/inode.c
===================================================================
--- linux-2.6.29.noarch.orig/fs/ext4/inode.c
+++ linux-2.6.29.noarch/fs/ext4/inode.c
@@ -2318,11 +2318,21 @@ static int ext4_da_get_block_prep(struct
 			/* not enough space to reserve */
 			return ret;
 
-		map_bh(bh_result, inode->i_sb, 0);
+		map_bh(bh_result, inode->i_sb, -1);
 		set_buffer_new(bh_result);
 		set_buffer_delay(bh_result);
 	} else if (ret > 0) {
 		bh_result->b_size = (ret << inode->i_blkbits);
+		/*
+		 * With sub-block writes into unwritten extents
+		 * we also need to mark the buffer as new so that
+		 * the unwritten parts of the buffer gets correctly zeroed.
+		 */
+		if (buffer_unwritten(bh_result)) {
+			bh_result->b_bdev = inode->i_sb->s_bdev;
+			set_buffer_new(bh_result);
+			bh_result->b_blocknr = -1;
+		}
 		ret = 0;
 	}
 


Index: kernel.spec
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/F-11/kernel.spec,v
retrieving revision 1.1581
retrieving revision 1.1582
diff -u -p -r1.1581 -r1.1582
--- kernel.spec	1 May 2009 18:41:25 -0000	1.1581
+++ kernel.spec	1 May 2009 18:59:33 -0000	1.1582
@@ -711,6 +711,7 @@ Patch2903: linux-2.6-revert-dvb-net-kabi
 # fs fixes
 Patch2920: linux-2.6-ext4-flush-on-close.patch
 Patch2921: linux-2.6-ext4-really-print-warning-once.patch
+Patch2922: linux-2.6-ext4-prealloc-fixes.patch
 
 Patch3000: linux-2.6-btrfs-experimental-branch.patch
 Patch3001: linux-2.6-btrfs-fix-umount-hang.patch
@@ -1185,6 +1186,7 @@ ApplyPatch linux-2.6-execshield.patch
 # ext4
 ApplyPatch linux-2.6-ext4-flush-on-close.patch
 ApplyPatch linux-2.6-ext4-really-print-warning-once.patch
+ApplyPatch linux-2.6-ext4-prealloc-fixes.patch
 
 # xfs
 
@@ -1960,6 +1962,9 @@ fi
 # and build.
 
 %changelog
+* Fri May 01 2009 Eric Sandeen <sandeen at redhat.com>
+- Fix ext4 corruption on partial write into prealloc block
+
 * Thu Apr 30 2009 Kyle McMartin <kyle at redhat.com> 2.6.29.2-119
 - Update to 2.6.29.2
 - Patches rebased:




More information about the scm-commits mailing list