Whamcloud - gitweb
- merge 0.7rc1 from b_devel to HEAD (20030612 merge point)
[fs/lustre-release.git] / lustre / kernel_patches / patches / ext3_orphan_lock-2.4.20-rh.patch
1  fs/ext3/namei.c            |   15 +++++++--------
2  fs/ext3/super.c            |    1 +
3  include/linux/ext3_fs_sb.h |    1 +
4  3 files changed, 9 insertions(+), 8 deletions(-)
5
6 --- linux-rh-2.4.20-8/fs/ext3/namei.c~ext3_orphan_lock-2.4.20-rh        2003-05-05 19:49:15.000000000 +0800
7 +++ linux-rh-2.4.20-8-root/fs/ext3/namei.c      2003-05-05 20:01:28.000000000 +0800
8 @@ -1747,8 +1747,8 @@ int ext3_orphan_add(handle_t *handle, st
9         struct super_block *sb = inode->i_sb;
10         struct ext3_iloc iloc;
11         int err = 0, rc;
12 -       
13 -       lock_super(sb);
14 +
15 +       down(&EXT3_SB(sb)->s_orphan_lock);
16         if (!list_empty(&EXT3_I(inode)->i_orphan))
17                 goto out_unlock;
18  
19 @@ -1796,7 +1796,7 @@ int ext3_orphan_add(handle_t *handle, st
20         jbd_debug(4, "orphan inode %ld will point to %d\n",
21                         inode->i_ino, NEXT_ORPHAN(inode));
22  out_unlock:
23 -       unlock_super(sb);
24 +       up(&EXT3_SB(sb)->s_orphan_lock);
25         ext3_std_error(inode->i_sb, err);
26         return err;
27  }
28 @@ -1809,20 +1809,19 @@ int ext3_orphan_del(handle_t *handle, st
29  {
30         struct list_head *prev;
31         struct ext3_inode_info *ei = EXT3_I(inode);
32 -       struct ext3_sb_info *sbi;
33 +       struct ext3_sb_info *sbi = EXT3_SB(inode->i_sb);
34         unsigned long ino_next;
35         struct ext3_iloc iloc;
36         int err = 0;
37  
38 -       lock_super(inode->i_sb);
39 +       down(&sbi->s_orphan_lock);
40         if (list_empty(&ei->i_orphan)) {
41 -               unlock_super(inode->i_sb);
42 +               up(&sbi->s_orphan_lock);
43                 return 0;
44         }
45  
46         ino_next = NEXT_ORPHAN(inode);
47         prev = ei->i_orphan.prev;
48 -       sbi = EXT3_SB(inode->i_sb);
49  
50         jbd_debug(4, "remove inode %lu from orphan list\n", inode->i_ino);
51  
52 @@ -1871,7 +1870,7 @@ int ext3_orphan_del(handle_t *handle, st
53  out_err:
54         ext3_std_error(inode->i_sb, err);
55  out:
56 -       unlock_super(inode->i_sb);
57 +       up(&sbi->s_orphan_lock);
58         return err;
59  
60  out_brelse:
61 --- linux-rh-2.4.20-8/fs/ext3/super.c~ext3_orphan_lock-2.4.20-rh        2003-05-05 19:49:15.000000000 +0800
62 +++ linux-rh-2.4.20-8-root/fs/ext3/super.c      2003-05-05 19:54:09.000000000 +0800
63 @@ -1151,6 +1151,7 @@ struct super_block * ext3_read_super (st
64          */
65         sb->s_op = &ext3_sops;
66         INIT_LIST_HEAD(&sbi->s_orphan); /* unlinked but open files */
67 +       sema_init(&sbi->s_orphan_lock, 1);
68  
69         sb->s_root = 0;
70  
71 --- linux-rh-2.4.20-8/include/linux/ext3_fs_sb.h~ext3_orphan_lock-2.4.20-rh     2003-05-05 19:49:07.000000000 +0800
72 +++ linux-rh-2.4.20-8-root/include/linux/ext3_fs_sb.h   2003-05-05 19:54:09.000000000 +0800
73 @@ -69,6 +69,7 @@ struct ext3_sb_info {
74         struct inode * s_journal_inode;
75         struct journal_s * s_journal;
76         struct list_head s_orphan;
77 +       struct semaphore s_orphan_lock;
78         unsigned long s_commit_interval;
79         struct block_device *journal_bdev;
80  #ifdef CONFIG_JBD_DEBUG
81
82 _