1 From ef58f69c3c34f6377f1e21d3533c806dbd980ad0 Mon Sep 17 00:00:00 2001
2 From: Tao Ma <boyu.mt@taobao.com>
3 Date: Mon, 9 Jul 2012 16:29:05 -0400
4 Subject: ext4: use proper csum calculation in ext4_rename
6 From: Tao Ma <boyu.mt@taobao.com>
8 commit ef58f69c3c34f6377f1e21d3533c806dbd980ad0 upstream.
10 In ext4_rename, when the old name is a dir, we need to
11 change ".." to its new parent and journal the change, so
12 with metadata_csum enabled, we have to re-calc the csum.
14 As the first block of the dir can be either a htree root
15 or a normal directory block and we have different csum
16 calculation for these 2 types, we have to choose the right
19 btw, it is found by xfstests 013.
21 Signed-off-by: Tao Ma <boyu.mt@taobao.com>
22 Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
23 Acked-by: Darrick J. Wong <djwong@us.ibm.com>
24 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
27 fs/ext4/namei.c | 11 +++++++++--
28 1 file changed, 9 insertions(+), 2 deletions(-)
32 @@ -2918,8 +2918,15 @@ static int ext4_rename(struct inode *old
33 PARENT_INO(dir_bh->b_data, new_dir->i_sb->s_blocksize) =
34 cpu_to_le32(new_dir->i_ino);
35 BUFFER_TRACE(dir_bh, "call ext4_handle_dirty_metadata");
36 - retval = ext4_handle_dirty_dirent_node(handle, old_inode,
38 + if (is_dx(old_inode)) {
39 + retval = ext4_handle_dirty_dx_node(handle,
43 + retval = ext4_handle_dirty_dirent_node(handle,
48 ext4_std_error(old_dir->i_sb, retval);