Patchwork [4/7] ext4: punch_hole fix extent conversion

login
register
mail settings
Submitter Dmitri Monakho
Date Oct. 28, 2011, 5 p.m.
Message ID <1319821210-7374-5-git-send-email-dmonakhov@openvz.org>
Download mbox | patch
Permalink /patch/122446/
State New
Headers show

Comments

Dmitri Monakho - Oct. 28, 2011, 5 p.m.
Currently punched extent converted to uninitialized incorrectly,
in fact i'm not shure whenever we actually need that conversion,
but if we do that let's do it right.

Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
---
 fs/ext4/extents.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

Patch

diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
index 02dfe38..0365173 100644
--- a/fs/ext4/extents.c
+++ b/fs/ext4/extents.c
@@ -3275,8 +3275,15 @@  ext4_ext_handle_punched_extent(handle_t *handle, struct inode *inode,
 		ex = path[path->p_depth].p_ext;
 	}
 
-	ext4_ext_mark_uninitialized(ex);
+	err = ext4_ext_get_access(handle, inode, path + path->p_depth);
+	if (err)
+		goto out;
 	ext4_ext_invalidate_cache(inode);
+	ext4_ext_mark_uninitialized(ex);
+	err = ext4_ext_dirty(handle, inode, path + path->p_depth);
+	if (err)
+		goto out;
+
 	err = ext4_ext_rm_leaf(handle, inode, path, &partial_cluster,
 			       map->m_lblk, map->m_lblk + punched_out);
 	if (!err && ext4_ext_try_shrink(handle, inode))