[Vivid][PATCH] UBUNTU: SAUCE: ext4: disable ext4_punch_hole for indirect filesystems

Chris J Arges chris.j.arges at canonical.com
Tue Feb 3 18:20:49 UTC 2015


BugLink: http://bugs.launchpad.net/bugs/1292234

Users of non-extent ext4 filesystems (ext4 ^extents, or ext3 w/
CONFIG_EXT4_USE_FOR_EXT23=y) can encounter data corruption when using fallocate
with FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE flags.

This patch returns EOPNOTSUPP when ext4_punch_hole is called from a non-extents
filesystem.

Signed-off-by: Chris J Arges <chris.j.arges at canonical.com>
---
 fs/ext4/inode.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index 3356ab5..d06d518 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -3390,6 +3390,10 @@ int ext4_punch_hole(struct inode *inode, loff_t offset, loff_t length)
 	unsigned int credits;
 	int ret = 0;
 
+	/* WORKAROUND: EXTENTS required (LP: #1292234) */
+	if (!(ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS)))
+		return -EOPNOTSUPP;
+
 	if (!S_ISREG(inode->i_mode))
 		return -EOPNOTSUPP;
 
-- 
1.9.1





More information about the kernel-team mailing list