[Devel] [PATCH RHEL7 COMMIT] pfcache/ext4: drop pfcache csum on fallocate

Konstantin Khorenko khorenko at virtuozzo.com
Fri Oct 2 01:06:21 PDT 2015


The commit is pushed to "branch-rh7-3.10.0-229.7.2.vz7.8.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-229.7.2.vz7.8.2
------>
commit ca88f84ba4810d4a9adc50c9455a3a5347fa3a88
Author: Dmitry Monakhov <dmonakhov at openvz.org>
Date:   Fri Oct 2 12:06:21 2015 +0400

    pfcache/ext4: drop pfcache csum on fallocate
    
    If fallocate changes file's data we have to drop csum.
    
    https://jira.sw.ru/browse/PSBM-33644
    
    Signed-off-by: Dmitry Monakhov <dmonakhov at openvz.org>
---
 fs/ext4/extents.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
index 08b0709..bac9339 100644
--- a/fs/ext4/extents.c
+++ b/fs/ext4/extents.c
@@ -5062,6 +5062,11 @@ long ext4_fallocate(struct file *file, int mode, loff_t offset, loff_t len)
 		     FALLOC_FL_CONVERT_AND_EXTEND))
 		return -EOPNOTSUPP;
 
+	/* If data is about to change we must drop csum */
+	if (ext4_test_inode_state(inode, EXT4_STATE_PFCACHE_CSUM) &&
+	    ((mode & ~FALLOC_FL_KEEP_SIZE)  || !(mode & FALLOC_FL_KEEP_SIZE)))
+		ext4_truncate_data_csum(inode, -1);
+
 	if (mode & FALLOC_FL_PUNCH_HOLE)
 		return ext4_punch_hole(inode, offset, len);
 



More information about the Devel mailing list