--- /dev/null
+ 0 files changed
+
+--- linux/fs/ext3/namei.c~ext3-orphan_lock-2.4.19 2003-06-04 18:02:30.000000000 +0800
++++ linux-root/fs/ext3/namei.c 2003-06-04 18:06:06.000000000 +0800
+@@ -1747,8 +1747,8 @@ int ext3_orphan_add(handle_t *handle, st
+ struct super_block *sb = inode->i_sb;
+ struct ext3_iloc iloc;
+ int err = 0, rc;
+-
+- lock_super(sb);
++
++ down(&EXT3_SB(sb)->s_orphan_lock);
+ if (!list_empty(&EXT3_I(inode)->i_orphan))
+ goto out_unlock;
+
+@@ -1796,7 +1796,7 @@ int ext3_orphan_add(handle_t *handle, st
+ jbd_debug(4, "orphan inode %ld will point to %d\n",
+ inode->i_ino, NEXT_ORPHAN(inode));
+ out_unlock:
+- unlock_super(sb);
++ up(&EXT3_SB(sb)->s_orphan_lock);
+ ext3_std_error(inode->i_sb, err);
+ return err;
+ }
+@@ -1809,20 +1809,19 @@ int ext3_orphan_del(handle_t *handle, st
+ {
+ struct list_head *prev;
+ struct ext3_inode_info *ei = EXT3_I(inode);
+- struct ext3_sb_info *sbi;
++ struct ext3_sb_info *sbi = EXT3_SB(inode->i_sb);
+ ino_t ino_next;
+ struct ext3_iloc iloc;
+ int err = 0;
+
+- lock_super(inode->i_sb);
++ down(&sbi->s_orphan_lock);
+ if (list_empty(&ei->i_orphan)) {
+- unlock_super(inode->i_sb);
++ up(&sbi->s_orphan_lock);
+ return 0;
+ }
+
+ ino_next = NEXT_ORPHAN(inode);
+ prev = ei->i_orphan.prev;
+- sbi = EXT3_SB(inode->i_sb);
+
+ jbd_debug(4, "remove inode %ld from orphan list\n", inode->i_ino);
+
+@@ -1871,7 +1870,7 @@ int ext3_orphan_del(handle_t *handle, st
+ out_err:
+ ext3_std_error(inode->i_sb, err);
+ out:
+- unlock_super(inode->i_sb);
++ up(&sbi->s_orphan_lock);
+ return err;
+
+ out_brelse:
+--- linux/fs/ext3/super.c~ext3-orphan_lock-2.4.19 2003-06-04 18:02:22.000000000 +0800
++++ linux-root/fs/ext3/super.c 2003-06-04 18:03:18.000000000 +0800
+@@ -1144,6 +1144,7 @@ struct super_block * ext3_read_super (st
+ */
+ sb->s_op = &ext3_sops;
+ INIT_LIST_HEAD(&sbi->s_orphan); /* unlinked but open files */
++ sema_init(&sbi->s_orphan_lock, 1);
+
+ sb->s_root = 0;
+
+--- linux/include/linux/ext3_fs_sb.h~ext3-orphan_lock-2.4.19 2003-06-04 18:02:22.000000000 +0800
++++ linux-root/include/linux/ext3_fs_sb.h 2003-06-04 18:03:18.000000000 +0800
+@@ -69,6 +69,7 @@ struct ext3_sb_info {
+ struct inode * s_journal_inode;
+ struct journal_s * s_journal;
+ struct list_head s_orphan;
++ struct semaphore s_orphan_lock;
+ unsigned long s_commit_interval;
+ struct block_device *journal_bdev;
+ #ifdef CONFIG_JBD_DEBUG
+
+_