Whamcloud - gitweb
LU-8364 ldiskfs: fixes for failover mode.
[fs/lustre-release.git] / ldiskfs / kernel_patches / patches / rhel6.3 / ext4-use-correct-inode.patch
1 From 5930ea643805feb50a2f8383ae12eb6f10935e49 Mon Sep 17 00:00:00 2001
2 From: Theodore Ts'o <tytso@mit.edu>
3 Date: Wed, 31 Aug 2011 12:02:51 -0400
4 Subject: [PATCH] ext4: call ext4_handle_dirty_metadata with correct inode in
5  ext4_dx_add_entry
6
7 ext4_dx_add_entry manipulates bh2 and frames[0].bh, which are two buffer_heads
8 that point to directory blocks assigned to the directory inode.  However, the
9 function calls ext4_handle_dirty_metadata with the inode of the file that's
10 being added to the directory, not the directory inode itself.  Therefore,
11 correct the code to dirty the directory buffers with the directory inode, not
12 the file inode.
13
14 Signed-off-by: Darrick J. Wong <djwong@us.ibm.com>
15 Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
16 Cc: stable@kernel.org
17 ---
18  fs/ext4/namei.c | 4 ++--
19  1 file changed, 2 insertions(+), 2 deletions(-)
20
21 diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
22 index f0abe43..a067835 100644
23 --- a/fs/ext4/namei.c
24 +++ b/fs/ext4/namei.c
25 @@ -1585,7 +1585,7 @@ static int ext4_dx_add_entry(handle_t *handle, struct dentry *dentry,
26                         dxtrace(dx_show_index("node", frames[1].entries));
27                         dxtrace(dx_show_index("node",
28                                ((struct dx_node *) bh2->b_data)->entries));
29 -                       err = ext4_handle_dirty_metadata(handle, inode, bh2);
30 +                       err = ext4_handle_dirty_metadata(handle, dir, bh2);
31                         if (err)
32                                 goto journal_error;
33                         brelse (bh2);
34 @@ -1611,7 +1611,11 @@ static int ext4_dx_add_entry(handle_t *handle, struct dentry *dentry,
35                         if (err)
36                                 goto journal_error;
37                 }
38 -               ext4_handle_dirty_metadata(handle, inode, frames[0].bh);
39 +               err = ext4_handle_dirty_metadata(handle, dir, frames[0].bh);
40 +               if (err) {
41 +                       ext4_std_error(inode->i_sb, err);
42 +                       goto cleanup;
43 +               }
44         }
45         de = do_split(handle, dir, &bh, frame, &hinfo, &err);
46         if (!de)
47 -- 
48 2.1.0
49