1 fs/ext3/namei.c | 15 +++++++--------
3 include/linux/ext3_fs_sb.h | 1 +
4 3 files changed, 9 insertions(+), 8 deletions(-)
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;
15 + down(&EXT3_SB(sb)->s_orphan_lock);
16 if (!list_empty(&EXT3_I(inode)->i_orphan))
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));
24 + up(&EXT3_SB(sb)->s_orphan_lock);
25 ext3_std_error(inode->i_sb, err);
28 @@ -1809,20 +1809,19 @@ int ext3_orphan_del(handle_t *handle, st
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;
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);
46 ino_next = NEXT_ORPHAN(inode);
47 prev = ei->i_orphan.prev;
48 - sbi = EXT3_SB(inode->i_sb);
50 jbd_debug(4, "remove inode %lu from orphan list\n", inode->i_ino);
52 @@ -1871,7 +1870,7 @@ int ext3_orphan_del(handle_t *handle, st
54 ext3_std_error(inode->i_sb, err);
56 - unlock_super(inode->i_sb);
57 + up(&sbi->s_orphan_lock);
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
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);
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