Whamcloud - gitweb
b=3119
[fs/lustre-release.git] / lustre / kernel_patches / patches / ext-2.4-patch-4.patch
1 # This is a BitKeeper generated patch for the following project:
2 # Project Name: Linux kernel tree
3 #
4 # namei.c |   21 ++++++++++++++++++++-
5 # 1 files changed, 20 insertions(+), 1 deletion(-)
6 #
7 # The following is the BitKeeper ChangeSet Log
8 # --------------------------------------------
9 # 02/11/07      tytso@snap.thunk.org    1.779
10 # Fix ext3 htree rename bug.
11
12 # This fixes an ext3 htree bug pointed out by Christopher Li; if 
13 # adding the new name to the directory causes a split, this can cause
14 # the directory entry containing the old name to move to another 
15 # block, and then the removal of the old name will fail.
16 # --------------------------------------------
17 #
18 diff -Nru a/fs/ext3/namei.c b/fs/ext3/namei.c
19 --- a/fs/ext3/namei.c   Thu Nov  7 10:57:49 2002
20 +++ b/fs/ext3/namei.c   Thu Nov  7 10:57:49 2002
21 @@ -2173,7 +2173,26 @@
22         /*
23          * ok, that's it
24          */
25 -       ext3_delete_entry(handle, old_dir, old_de, old_bh);
26 +       retval = ext3_delete_entry(handle, old_dir, old_de, old_bh);
27 +       if (retval == -ENOENT) {
28 +               /*
29 +                * old_de could have moved out from under us.
30 +                */
31 +               struct buffer_head *old_bh2;
32 +               struct ext3_dir_entry_2 *old_de2;
33 +               
34 +               old_bh2 = ext3_find_entry(old_dentry, &old_de2);
35 +               if (old_bh2) {
36 +                       retval = ext3_delete_entry(handle, old_dir,
37 +                                                  old_de2, old_bh2);
38 +                       brelse(old_bh2);
39 +               }
40 +       }
41 +       if (retval) {
42 +               ext3_warning(old_dir->i_sb, "ext3_rename",
43 +                               "Deleting old file (%lu), %d, error=%d",
44 +                               old_dir->i_ino, old_dir->i_nlink, retval);
45 +       }
46  
47         if (new_inode) {
48                 new_inode->i_nlink--;