1 fs/ext3/namei.c | 15 +++++++--------
2 fs/ext3/namei.c.orig | 21 +++++++++++++++------
4 include/linux/ext3_fs_sb.h | 1 +
5 include/linux/ext3_fs_sb.h.orig | 2 ++
6 5 files changed, 26 insertions(+), 14 deletions(-)
8 --- linux-2.4.22-ac1/fs/ext3/namei.c~ext3-orphan_lock-2.4.22-rh 2003-09-26 00:24:09.000000000 +0400
9 +++ linux-2.4.22-ac1-alexey/fs/ext3/namei.c 2003-09-26 00:26:36.000000000 +0400
10 @@ -1748,8 +1748,8 @@ int ext3_orphan_add(handle_t *handle, st
11 struct super_block *sb = inode->i_sb;
12 struct ext3_iloc iloc;
17 + down(&EXT3_SB(sb)->s_orphan_lock);
18 if (!list_empty(&EXT3_I(inode)->i_orphan))
21 @@ -1797,7 +1797,7 @@ int ext3_orphan_add(handle_t *handle, st
22 jbd_debug(4, "orphan inode %ld will point to %d\n",
23 inode->i_ino, NEXT_ORPHAN(inode));
26 + up(&EXT3_SB(sb)->s_orphan_lock);
27 ext3_std_error(inode->i_sb, err);
30 @@ -1810,20 +1810,19 @@ int ext3_orphan_del(handle_t *handle, st
32 struct list_head *prev;
33 struct ext3_inode_info *ei = EXT3_I(inode);
34 - struct ext3_sb_info *sbi;
35 + struct ext3_sb_info *sbi = EXT3_SB(inode->i_sb);
36 unsigned long ino_next;
37 struct ext3_iloc iloc;
40 - lock_super(inode->i_sb);
41 + down(&sbi->s_orphan_lock);
42 if (list_empty(&ei->i_orphan)) {
43 - unlock_super(inode->i_sb);
44 + up(&sbi->s_orphan_lock);
48 ino_next = NEXT_ORPHAN(inode);
49 prev = ei->i_orphan.prev;
50 - sbi = EXT3_SB(inode->i_sb);
52 jbd_debug(4, "remove inode %lu from orphan list\n", inode->i_ino);
54 @@ -1872,7 +1871,7 @@ int ext3_orphan_del(handle_t *handle, st
56 ext3_std_error(inode->i_sb, err);
58 - unlock_super(inode->i_sb);
59 + up(&sbi->s_orphan_lock);
63 --- linux-2.4.22-ac1/fs/ext3/super.c~ext3-orphan_lock-2.4.22-rh 2003-09-26 00:24:09.000000000 +0400
64 +++ linux-2.4.22-ac1-alexey/fs/ext3/super.c 2003-09-26 00:25:22.000000000 +0400
65 @@ -1164,6 +1164,7 @@ struct super_block * ext3_read_super (st
66 sb->s_op = &ext3_sops;
67 sb->dq_op = &ext3_qops;
68 INIT_LIST_HEAD(&sbi->s_orphan); /* unlinked but open files */
69 + sema_init(&sbi->s_orphan_lock, 1);
73 --- linux-2.4.22-ac1/include/linux/ext3_fs_sb.h~ext3-orphan_lock-2.4.22-rh 2003-09-26 00:24:08.000000000 +0400
74 +++ linux-2.4.22-ac1-alexey/include/linux/ext3_fs_sb.h 2003-09-26 00:25:22.000000000 +0400
75 @@ -72,6 +72,7 @@ struct ext3_sb_info {
76 struct inode * s_journal_inode;
77 struct journal_s * s_journal;
78 struct list_head s_orphan;
79 + struct semaphore s_orphan_lock;
80 unsigned long s_commit_interval;
81 struct block_device *journal_bdev;
82 #ifdef CONFIG_JBD_DEBUG