Whamcloud - gitweb
smash the HEAD with the contents of b_cmd. HEAD_PRE_CMD_SMASH and
[fs/lustre-release.git] / lustre / kernel_patches / patches / ext3-orphan_lock-2.4.19-suse.patch
1 Index: linux-2.4.19.SuSE/fs/ext3/namei.c
2 ===================================================================
3 --- linux-2.4.19.SuSE.orig/fs/ext3/namei.c      Sun Nov 16 01:14:50 2003
4 +++ linux-2.4.19.SuSE/fs/ext3/namei.c   Sun Nov 16 01:18:04 2003
5 @@ -1751,8 +1751,8 @@
6         struct super_block *sb = inode->i_sb;
7         struct ext3_iloc iloc;
8         int err = 0, rc;
9 -       
10 -       lock_super(sb);
11 +
12 +       down(&EXT3_SB(sb)->s_orphan_lock);
13         if (!list_empty(&EXT3_I(inode)->i_orphan))
14                 goto out_unlock;
15  
16 @@ -1800,7 +1800,7 @@
17         jbd_debug(4, "orphan inode %ld will point to %d\n",
18                         inode->i_ino, NEXT_ORPHAN(inode));
19  out_unlock:
20 -       unlock_super(sb);
21 +       up(&EXT3_SB(sb)->s_orphan_lock);
22         ext3_std_error(inode->i_sb, err);
23         return err;
24  }
25 @@ -1813,20 +1813,19 @@
26  {
27         struct list_head *prev;
28         struct ext3_inode_info *ei = EXT3_I(inode);
29 -       struct ext3_sb_info *sbi;
30 +       struct ext3_sb_info *sbi = EXT3_SB(inode->i_sb);
31         unsigned long ino_next;
32         struct ext3_iloc iloc;
33         int err = 0;
34  
35 -       lock_super(inode->i_sb);
36 +       down(&sbi->s_orphan_lock);
37         if (list_empty(&ei->i_orphan)) {
38 -               unlock_super(inode->i_sb);
39 +               up(&sbi->s_orphan_lock);
40                 return 0;
41         }
42  
43         ino_next = NEXT_ORPHAN(inode);
44         prev = ei->i_orphan.prev;
45 -       sbi = EXT3_SB(inode->i_sb);
46  
47         jbd_debug(4, "remove inode %lu from orphan list\n", inode->i_ino);
48  
49 @@ -1872,10 +1871,10 @@
50         if (err)
51                 goto out_brelse;
52  
53 -out_err: 
54 +out_err:
55         ext3_std_error(inode->i_sb, err);
56  out:
57 -       unlock_super(inode->i_sb);
58 +       up(&sbi->s_orphan_lock);
59         return err;
60  
61  out_brelse:
62 Index: linux-2.4.19.SuSE/fs/ext3/super.c
63 ===================================================================
64 --- linux-2.4.19.SuSE.orig/fs/ext3/super.c      Sun Nov 16 00:40:59 2003
65 +++ linux-2.4.19.SuSE/fs/ext3/super.c   Sun Nov 16 01:18:04 2003
66 @@ -1182,6 +1182,7 @@
67          */
68         sb->s_op = &ext3_sops;
69         INIT_LIST_HEAD(&sbi->s_orphan); /* unlinked but open files */
70 +       sema_init(&sbi->s_orphan_lock, 1);
71  
72         sb->s_root = 0;
73  
74 Index: linux-2.4.19.SuSE/include/linux/ext3_fs_sb.h
75 ===================================================================
76 --- linux-2.4.19.SuSE.orig/include/linux/ext3_fs_sb.h   Sat Nov 15 23:58:28 2003
77 +++ linux-2.4.19.SuSE/include/linux/ext3_fs_sb.h        Sun Nov 16 01:18:41 2003
78 @@ -69,6 +69,7 @@
79         struct inode * s_journal_inode;
80         struct journal_s * s_journal;
81         struct list_head s_orphan;
82 +       struct semaphore s_orphan_lock;
83         struct block_device *journal_bdev;
84  #ifdef CONFIG_JBD_DEBUG
85         struct timer_list turn_ro_timer;        /* For turning read-only (crash simulation) */