1 Index: linux-2.4.19/fs/ext3/namei.c
2 ===================================================================
3 --- linux-2.4.19.orig/fs/ext3/namei.c 2004-04-23 22:36:03.000000000 -0400
4 +++ linux-2.4.19/fs/ext3/namei.c 2004-04-23 22:37:37.000000000 -0400
6 struct super_block *sb = inode->i_sb;
12 + down(&EXT3_SB(sb)->s_orphan_lock);
13 if (!list_empty(&EXT3_I(inode)->i_orphan))
17 jbd_debug(4, "orphan inode %ld will point to %d\n",
18 inode->i_ino, NEXT_ORPHAN(inode));
21 + up(&EXT3_SB(sb)->s_orphan_lock);
22 ext3_std_error(inode->i_sb, err);
25 @@ -1813,20 +1813,19 @@
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;
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);
43 ino_next = NEXT_ORPHAN(inode);
44 prev = ei->i_orphan.prev;
45 - sbi = EXT3_SB(inode->i_sb);
47 jbd_debug(4, "remove inode %lu from orphan list\n", inode->i_ino);
49 @@ -1872,10 +1871,10 @@
55 ext3_std_error(inode->i_sb, err);
57 - unlock_super(inode->i_sb);
58 + up(&sbi->s_orphan_lock);
62 Index: linux-2.4.19/fs/ext3/super.c
63 ===================================================================
64 --- linux-2.4.19.orig/fs/ext3/super.c 2004-04-23 22:30:41.000000000 -0400
65 +++ linux-2.4.19/fs/ext3/super.c 2004-04-23 22:36:22.000000000 -0400
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);
74 Index: linux-2.4.19/include/linux/ext3_fs_sb.h
75 ===================================================================
76 --- linux-2.4.19.orig/include/linux/ext3_fs_sb.h 2004-04-23 18:26:27.000000000 -0400
77 +++ linux-2.4.19/include/linux/ext3_fs_sb.h 2004-04-23 22:36:22.000000000 -0400
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) */