]> git.hungrycats.org Git - linux/commitdiff
ext4: Fix block zeroing when punching holes in indirect block files
authorJan Kara <jack@suse.cz>
Thu, 26 Jun 2014 16:28:57 +0000 (12:28 -0400)
committerJiri Slaby <jslaby@suse.cz>
Tue, 26 Aug 2014 12:12:06 +0000 (14:12 +0200)
commit 77ea2a4ba657a1ad4fb7c64bc5cdce84b8a132b6 upstream.

free_holes_block() passed local variable as a block pointer
to ext4_clear_blocks(). Thus ext4_clear_blocks() zeroed out this local
variable instead of proper place in inode / indirect block. We later
zero out proper place in inode / indirect block but don't dirty the
inode / buffer again which can lead to subtle issues (some changes e.g.
to inode can be lost).

Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
fs/ext4/indirect.c

index e6574d7b6642051c7cc85ac0aa988b07ede3f1bc..c30cbe291e305aa9dd185270c2bee3376f7a070c 100644 (file)
@@ -1345,8 +1345,8 @@ static int free_hole_blocks(handle_t *handle, struct inode *inode,
                if (level == 0 ||
                    (bh && all_zeroes((__le32 *)bh->b_data,
                                      (__le32 *)bh->b_data + addr_per_block))) {
-                       ext4_free_data(handle, inode, parent_bh, &blk, &blk+1);
-                       *i_data = 0;
+                       ext4_free_data(handle, inode, parent_bh,
+                                      i_data, i_data + 1);
                }
                brelse(bh);
                bh = NULL;