rpms/kernel/devel linux-2.6-ext4-prealloc-fixes.patch, NONE, 1.1 kernel.spec, 1.1538, 1.1539

Eric Sandeen sandeen at fedoraproject.org
Fri May 1 18:29:46 UTC 2009


Author: sandeen

Update of /cvs/pkgs/rpms/kernel/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv16868

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/devel/kernel.spec,v
retrieving revision 1.1538
retrieving revision 1.1539
diff -u -p -r1.1538 -r1.1539
--- kernel.spec	30 Apr 2009 21:03:29 -0000	1.1538
+++ kernel.spec	1 May 2009 18:29:15 -0000	1.1539
@@ -602,6 +602,9 @@ Patch147: linux-2.6-imac-transparent-bri
 Patch150: linux-2.6.29-sparc-IOC_TYPECHECK.patch
 
 Patch160: linux-2.6-execshield.patch
+
+Patch200: linux-2.6-ext4-prealloc-fixes.patch
+
 Patch250: linux-2.6-debug-sizeof-structs.patch
 Patch260: linux-2.6-debug-nmi-timeout.patch
 Patch270: linux-2.6-debug-taint-vm.patch
@@ -1123,6 +1126,7 @@ ApplyPatch linux-2.6-execshield.patch
 #
 
 # ext4
+ApplyPatch linux-2.6-ext4-prealloc-fixes.patch
 
 # xfs
 
@@ -1832,6 +1836,9 @@ fi
 #	                ||----w |
 #	                ||     ||
 %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.30-rc4
 




More information about the scm-commits mailing list