Whamcloud - gitweb
fc7c7915aff09c144f0ab2aa146e85c452b7b845
[fs/lustre-release.git] / ldiskfs / kernel_patches / patches / ext4-pdir-fix-rhel6.patch
1 Index: linux-2.6.32.i386/fs/ext4/ext4.h
2 ===================================================================
3 --- linux-2.6.32.i386.orig/fs/ext4/ext4.h       2010-04-16 03:39:11.000000000 +0530
4 +++ linux-2.6.32.i386/fs/ext4/ext4.h    2010-04-16 04:27:41.000000000 +0530
5 @@ -29,6 +29,7 @@
6  #ifndef _EXT4_H
7  #define _EXT4_H
8  
9 +#include <linux/dynlocks.h>
10  #include <linux/types.h>
11  #include <linux/blkdev.h>
12  #include <linux/magic.h>
13 @@ -621,6 +622,10 @@
14         ext4_fsblk_t    i_file_acl;
15         __u32   i_dtime;
16  
17 +       /* following fields for parallel directory operations -bzzz */
18 +       struct dynlock   i_htree_lock;
19 +       struct semaphore i_append_sem;
20 +
21         /*
22          * i_block_group is the number of the block group which contains
23          * this file's inode.  Constant across the lifetime of the inode,
24 Index: linux-2.6.32.i386/fs/ext4/namei.c
25 ===================================================================
26 --- linux-2.6.32.i386.orig/fs/ext4/namei.c      2010-04-15 07:42:15.000000000 +0530
27 +++ linux-2.6.32.i386/fs/ext4/namei.c   2010-04-16 04:26:03.000000000 +0530
28 @@ -54,6 +54,11 @@
29                                         ext4_lblk_t *block, int *err)
30  {
31         struct buffer_head *bh;
32 +       struct ext4_inode_info *ei = EXT4_I(inode);
33 +
34 +       /* with parallel dir operations all appends
35 +       * have to be serialized -bzzz */
36 +       down(&ei->i_append_sem);
37  
38         *block = inode->i_size >> inode->i_sb->s_blocksize_bits;
39  
40 @@ -66,7 +71,9 @@
41                         brelse(bh);
42                         bh = NULL;
43                 }
44 +               ei->i_disksize = inode->i_size;
45         }
46 +       up(&ei->i_append_sem);
47         return bh;
48  }
49  
50 Index: linux-2.6.32.i386/fs/ext4/super.c
51 ===================================================================
52 --- linux-2.6.32.i386.orig/fs/ext4/super.c      2010-04-16 03:39:11.000000000 +0530
53 +++ linux-2.6.32.i386/fs/ext4/super.c   2010-04-16 04:26:03.000000000 +0530
54 @@ -700,6 +700,8 @@
55  
56         ei->vfs_inode.i_version = 1;
57         ei->vfs_inode.i_data.writeback_index = 0;
58 +       dynlock_init(&ei->i_htree_lock);
59 +       sema_init(&ei->i_append_sem, 1);
60         memset(&ei->i_cached_extent, 0, sizeof(struct ext4_ext_cache));
61         INIT_LIST_HEAD(&ei->i_prealloc_list);
62         spin_lock_init(&ei->i_prealloc_lock);