Whamcloud - gitweb
Branch b1_6
authorjohann <johann>
Mon, 28 Jul 2008 08:43:45 +0000 (08:43 +0000)
committerjohann <johann>
Mon, 28 Jul 2008 08:43:45 +0000 (08:43 +0000)
b=16362
i=bzzz
i=adilger

looking up an inode via iopen with the wrong generation number can
populate the dcache with a disconneced dentry while the inode
number is in the process of being reallocated. This causes an
assertion failure in iopen since the inode's dentry list contains
both a connected and disconnected dentry.

ldiskfs/kernel_patches/patches/iopen-2.6-fc5.patch
ldiskfs/kernel_patches/patches/iopen-2.6-rhel4.patch
ldiskfs/kernel_patches/patches/iopen-2.6-suse.patch
ldiskfs/kernel_patches/patches/iopen-2.6.18-rhel5.patch
ldiskfs/kernel_patches/patches/iopen-2.6.22-vanilla.patch

index 4dbe2ef..d639c5e 100644 (file)
@@ -1,8 +1,8 @@
-Index: linux-stage/fs/ext3/iopen.c
+Index: linux-2.6.16.54-0.2.5/fs/ext3/iopen.c
 ===================================================================
 --- /dev/null
 ===================================================================
 --- /dev/null
-+++ linux-stage/fs/ext3/iopen.c
-@@ -0,0 +1,259 @@
++++ linux-2.6.16.54-0.2.5/fs/ext3/iopen.c
+@@ -0,0 +1,295 @@
 +/*
 + * linux/fs/ext3/iopen.c
 + *
 +/*
 + * linux/fs/ext3/iopen.c
 + *
@@ -184,6 +184,42 @@ Index: linux-stage/fs/ext3/iopen.c
 +}
 +
 +/*
 +}
 +
 +/*
++ * Similar as d_instantiate() except that it drops the disconnected
++ * dentry if any.
++ */
++void iopen_d_instantiate(struct dentry *dentry, struct inode * inode)
++{
++      struct dentry *dis_dentry;
++
++      /* verify this dentry is really new */
++      assert(dentry->d_inode == NULL);
++      assert(list_empty(&dentry->d_alias));
++
++      spin_lock(&dcache_lock);
++      if (!inode || !test_opt(inode->i_sb, IOPEN) ||
++          list_empty(&inode->i_dentry))
++              goto do_instantiate;
++
++      /* a disconnected dentry has been added in our back,
++       * we have to drop this dentry, see bug 16362/15713*/
++      dis_dentry = list_entry(inode->i_dentry.next, struct dentry, d_alias);
++      spin_lock(&dis_dentry->d_lock);
++      assert(dis_dentry->d_alias.next == &inode->i_dentry);
++      assert(dis_dentry->d_alias.prev == &inode->i_dentry);
++      assert(dis_dentry->d_flags & DCACHE_DISCONNECTED);
++      __d_drop(dis_dentry);
++      list_del_init(&dis_dentry->d_alias);
++      spin_unlock(&dis_dentry->d_lock);
++
++do_instantiate:
++      if (inode)
++              list_add(&dentry->d_alias, &inode->i_dentry);
++      dentry->d_inode = inode;
++      spin_unlock(&dcache_lock);
++      security_d_instantiate(dentry, inode);
++}
++
++/*
 + * These are the special structures for the iopen pseudo directory.
 + */
 +
 + * These are the special structures for the iopen pseudo directory.
 + */
 +
@@ -262,11 +298,11 @@ Index: linux-stage/fs/ext3/iopen.c
 +
 +      return 1;
 +}
 +
 +      return 1;
 +}
-Index: linux-stage/fs/ext3/iopen.h
+Index: linux-2.6.16.54-0.2.5/fs/ext3/iopen.h
 ===================================================================
 --- /dev/null
 ===================================================================
 --- /dev/null
-+++ linux-stage/fs/ext3/iopen.h
-@@ -0,0 +1,19 @@
++++ linux-2.6.16.54-0.2.5/fs/ext3/iopen.h
+@@ -0,0 +1,20 @@
 +/*
 + * iopen.h
 + *
 +/*
 + * iopen.h
 + *
@@ -282,14 +318,15 @@ Index: linux-stage/fs/ext3/iopen.h
 +extern int ext3_iopen_get_inode(struct inode *inode);
 +extern struct dentry *iopen_connect_dentry(struct dentry *dentry,
 +                                         struct inode *inode, int rehash);
 +extern int ext3_iopen_get_inode(struct inode *inode);
 +extern struct dentry *iopen_connect_dentry(struct dentry *dentry,
 +                                         struct inode *inode, int rehash);
++extern void iopen_d_instantiate(struct dentry *dentry, struct inode * inode);
 +
 +#if !defined(HAVE_D_MOVE_LOCKED) && defined(HAVE___D_MOVE)
 +#define d_move_locked(dentry, target) __d_move(dentry, target)
 +#endif
 +
 +#if !defined(HAVE_D_MOVE_LOCKED) && defined(HAVE___D_MOVE)
 +#define d_move_locked(dentry, target) __d_move(dentry, target)
 +#endif
-Index: linux-stage/fs/ext3/inode.c
+Index: linux-2.6.16.54-0.2.5/fs/ext3/inode.c
 ===================================================================
 ===================================================================
---- linux-stage.orig/fs/ext3/inode.c
-+++ linux-stage/fs/ext3/inode.c
+--- linux-2.6.16.54-0.2.5.orig/fs/ext3/inode.c
++++ linux-2.6.16.54-0.2.5/fs/ext3/inode.c
 @@ -37,6 +37,7 @@
  #include <linux/mpage.h>
  #include <linux/uio.h>
 @@ -37,6 +37,7 @@
  #include <linux/mpage.h>
  #include <linux/uio.h>
@@ -307,10 +344,10 @@ Index: linux-stage/fs/ext3/inode.c
  
        if (__ext3_get_inode_loc(inode, &iloc, 0))
                goto bad_inode;
  
        if (__ext3_get_inode_loc(inode, &iloc, 0))
                goto bad_inode;
-Index: linux-stage/fs/ext3/super.c
+Index: linux-2.6.16.54-0.2.5/fs/ext3/super.c
 ===================================================================
 ===================================================================
---- linux-stage.orig/fs/ext3/super.c
-+++ linux-stage/fs/ext3/super.c
+--- linux-2.6.16.54-0.2.5.orig/fs/ext3/super.c
++++ linux-2.6.16.54-0.2.5/fs/ext3/super.c
 @@ -675,6 +675,7 @@ enum {
        Opt_usrjquota, Opt_grpjquota, Opt_offusrjquota, Opt_offgrpjquota,
        Opt_jqfmt_vfsold, Opt_jqfmt_vfsv0, Opt_quota, Opt_noquota,
 @@ -675,6 +675,7 @@ enum {
        Opt_usrjquota, Opt_grpjquota, Opt_offusrjquota, Opt_offgrpjquota,
        Opt_jqfmt_vfsold, Opt_jqfmt_vfsv0, Opt_quota, Opt_noquota,
@@ -348,10 +385,10 @@ Index: linux-stage/fs/ext3/super.c
                case Opt_ignore:
                        break;
                case Opt_resize:
                case Opt_ignore:
                        break;
                case Opt_resize:
-Index: linux-stage/fs/ext3/namei.c
+Index: linux-2.6.16.54-0.2.5/fs/ext3/namei.c
 ===================================================================
 ===================================================================
---- linux-stage.orig/fs/ext3/namei.c
-+++ linux-stage/fs/ext3/namei.c
+--- linux-2.6.16.54-0.2.5.orig/fs/ext3/namei.c
++++ linux-2.6.16.54-0.2.5/fs/ext3/namei.c
 @@ -39,6 +39,7 @@
  
  #include "namei.h"
 @@ -39,6 +39,7 @@
  
  #include "namei.h"
@@ -380,6 +417,24 @@ Index: linux-stage/fs/ext3/namei.c
  }
  
  
  }
  
  
+@@ -1649,7 +1654,7 @@ static int ext3_add_nondir(handle_t *han
+       int err = ext3_add_entry(handle, dentry, inode);
+       if (!err) {
+               ext3_mark_inode_dirty(handle, inode);
+-              d_instantiate(dentry, inode);
++              iopen_d_instantiate(dentry, inode);
+               return 0;
+       }
+       ext3_dec_count(handle, inode);
+@@ -1811,7 +1816,7 @@ retry:
+       dir->i_nlink++;
+       ext3_update_dx_flag(dir);
+       ext3_mark_inode_dirty(handle, dir);
+-      d_instantiate(dentry, inode);
++      iopen_d_instantiate(dentry, inode);
+ out_stop:
+       ext3_journal_stop(handle);
+       if (err == -ENOSPC && ext3_should_retry_alloc(dir->i_sb, &retries))
 @@ -2079,10 +2084,6 @@ static int ext3_rmdir (struct inode * di
                              inode->i_nlink);
        inode->i_version++;
 @@ -2079,10 +2084,6 @@ static int ext3_rmdir (struct inode * di
                              inode->i_nlink);
        inode->i_version++;
@@ -425,10 +480,10 @@ Index: linux-stage/fs/ext3/namei.c
        ext3_journal_stop(handle);
        if (err == -ENOSPC && ext3_should_retry_alloc(dir->i_sb, &retries))
                goto retry;
        ext3_journal_stop(handle);
        if (err == -ENOSPC && ext3_should_retry_alloc(dir->i_sb, &retries))
                goto retry;
-Index: linux-stage/fs/ext3/Makefile
+Index: linux-2.6.16.54-0.2.5/fs/ext3/Makefile
 ===================================================================
 ===================================================================
---- linux-stage.orig/fs/ext3/Makefile
-+++ linux-stage/fs/ext3/Makefile
+--- linux-2.6.16.54-0.2.5.orig/fs/ext3/Makefile
++++ linux-2.6.16.54-0.2.5/fs/ext3/Makefile
 @@ -4,7 +4,7 @@
  
  obj-$(CONFIG_EXT3_FS) += ext3.o
 @@ -4,7 +4,7 @@
  
  obj-$(CONFIG_EXT3_FS) += ext3.o
@@ -438,10 +493,10 @@ Index: linux-stage/fs/ext3/Makefile
           ioctl.o namei.o super.o symlink.o hash.o resize.o
  
  ext3-$(CONFIG_EXT3_FS_XATTR)   += xattr.o xattr_user.o xattr_trusted.o
           ioctl.o namei.o super.o symlink.o hash.o resize.o
  
  ext3-$(CONFIG_EXT3_FS_XATTR)   += xattr.o xattr_user.o xattr_trusted.o
-Index: linux-stage/include/linux/ext3_fs.h
+Index: linux-2.6.16.54-0.2.5/include/linux/ext3_fs.h
 ===================================================================
 ===================================================================
---- linux-stage.orig/include/linux/ext3_fs.h
-+++ linux-stage/include/linux/ext3_fs.h
+--- linux-2.6.16.54-0.2.5.orig/include/linux/ext3_fs.h
++++ linux-2.6.16.54-0.2.5/include/linux/ext3_fs.h
 @@ -375,6 +375,8 @@ struct ext3_inode {
  #define EXT3_MOUNT_QUOTA              0x80000 /* Some quota option set */
  #define EXT3_MOUNT_USRQUOTA           0x100000 /* "old" user quota */
 @@ -375,6 +375,8 @@ struct ext3_inode {
  #define EXT3_MOUNT_QUOTA              0x80000 /* Some quota option set */
  #define EXT3_MOUNT_USRQUOTA           0x100000 /* "old" user quota */
index 731ce38..d3a9aa3 100644 (file)
@@ -1,7 +1,7 @@
-Index: linux-stage/fs/ext3/Makefile
+Index: linux-2.6.9-67/fs/ext3/Makefile
 ===================================================================
 ===================================================================
---- linux-stage.orig/fs/ext3/Makefile  2005-02-25 14:31:53.151076368 +0200
-+++ linux-stage/fs/ext3/Makefile       2005-02-25 14:41:51.259150120 +0200
+--- linux-2.6.9-67.orig/fs/ext3/Makefile
++++ linux-2.6.9-67/fs/ext3/Makefile
 @@ -4,7 +4,7 @@
  
  obj-$(CONFIG_EXT3_FS) += ext3.o
 @@ -4,7 +4,7 @@
  
  obj-$(CONFIG_EXT3_FS) += ext3.o
@@ -11,10 +11,10 @@ Index: linux-stage/fs/ext3/Makefile
           ioctl.o namei.o super.o symlink.o hash.o resize.o
  
  ext3-$(CONFIG_EXT3_FS_XATTR)   += xattr.o xattr_user.o xattr_trusted.o
           ioctl.o namei.o super.o symlink.o hash.o resize.o
  
  ext3-$(CONFIG_EXT3_FS_XATTR)   += xattr.o xattr_user.o xattr_trusted.o
-Index: linux-stage/fs/ext3/inode.c
+Index: linux-2.6.9-67/fs/ext3/inode.c
 ===================================================================
 ===================================================================
---- linux-stage.orig/fs/ext3/inode.c   2005-02-25 14:37:30.983718000 +0200
-+++ linux-stage/fs/ext3/inode.c        2005-02-25 14:47:42.069818792 +0200
+--- linux-2.6.9-67.orig/fs/ext3/inode.c
++++ linux-2.6.9-67/fs/ext3/inode.c
 @@ -37,6 +37,7 @@
  #include <linux/mpage.h>
  #include <linux/uio.h>
 @@ -37,6 +37,7 @@
  #include <linux/mpage.h>
  #include <linux/uio.h>
@@ -23,7 +23,7 @@ Index: linux-stage/fs/ext3/inode.c
  #include "acl.h"
  
  /*
  #include "acl.h"
  
  /*
-@@ -2408,6 +2409,8 @@
+@@ -2409,6 +2410,8 @@ void ext3_read_inode(struct inode * inod
        ei->i_default_acl = EXT3_ACL_NOT_CACHED;
  #endif
        ei->i_rsv_window.rsv_end = EXT3_RESERVE_WINDOW_NOT_ALLOCATED;
        ei->i_default_acl = EXT3_ACL_NOT_CACHED;
  #endif
        ei->i_rsv_window.rsv_end = EXT3_RESERVE_WINDOW_NOT_ALLOCATED;
@@ -32,11 +32,11 @@ Index: linux-stage/fs/ext3/inode.c
  
        if (ext3_get_inode_loc(inode, &iloc, 0))
                goto bad_inode;
  
        if (ext3_get_inode_loc(inode, &iloc, 0))
                goto bad_inode;
-Index: linux-stage/fs/ext3/iopen.c
+Index: linux-2.6.9-67/fs/ext3/iopen.c
 ===================================================================
 ===================================================================
---- linux-stage.orig/fs/ext3/iopen.c   2005-02-25 14:41:01.017787968 +0200
-+++ linux-stage/fs/ext3/iopen.c        2005-02-25 14:41:01.045783712 +0200
-@@ -0,0 +1,278 @@
+--- /dev/null
++++ linux-2.6.9-67/fs/ext3/iopen.c
+@@ -0,0 +1,314 @@
 +/*
 + * linux/fs/ext3/iopen.c
 + *
 +/*
 + * linux/fs/ext3/iopen.c
 + *
@@ -237,6 +237,42 @@ Index: linux-stage/fs/ext3/iopen.c
 +}
 +
 +/*
 +}
 +
 +/*
++ * Similar as d_instantiate() except that it drops the disconnected
++ * dentry if any.
++ */
++void iopen_d_instantiate(struct dentry *dentry, struct inode * inode)
++{
++      struct dentry *dis_dentry;
++
++      /* verify this dentry is really new */
++      assert(dentry->d_inode == NULL);
++      assert(list_empty(&dentry->d_alias));
++
++      spin_lock(&dcache_lock);
++      if (!inode || !test_opt(inode->i_sb, IOPEN) ||
++          list_empty(&inode->i_dentry))
++              goto do_instantiate;
++
++      /* a disconnected dentry has been added in our back,
++       * we have to drop this dentry, see bug 16362/15713*/
++      dis_dentry = list_entry(inode->i_dentry.next, struct dentry, d_alias);
++      spin_lock(&dis_dentry->d_lock);
++      assert(dis_dentry->d_alias.next == &inode->i_dentry);
++      assert(dis_dentry->d_alias.prev == &inode->i_dentry);
++      assert(dis_dentry->d_flags & DCACHE_DISCONNECTED);
++      __d_drop(dis_dentry);
++      list_del_init(&dis_dentry->d_alias);
++      spin_unlock(&dis_dentry->d_lock);
++
++do_instantiate:
++      if (inode)
++              list_add(&dentry->d_alias, &inode->i_dentry);
++      dentry->d_inode = inode;
++      spin_unlock(&dcache_lock);
++      security_d_instantiate(dentry, inode);
++}
++
++/*
 + * These are the special structures for the iopen pseudo directory.
 + */
 +
 + * These are the special structures for the iopen pseudo directory.
 + */
 +
@@ -315,11 +351,11 @@ Index: linux-stage/fs/ext3/iopen.c
 +
 +      return 1;
 +}
 +
 +      return 1;
 +}
-Index: linux-stage/fs/ext3/iopen.h
+Index: linux-2.6.9-67/fs/ext3/iopen.h
 ===================================================================
 ===================================================================
---- linux-stage.orig/fs/ext3/iopen.h   2005-02-25 14:41:01.017787968 +0200
-+++ linux-stage/fs/ext3/iopen.h        2005-02-25 14:41:01.045783712 +0200
-@@ -0,0 +1,23 @@
+--- /dev/null
++++ linux-2.6.9-67/fs/ext3/iopen.h
+@@ -0,0 +1,24 @@
 +/*
 + * iopen.h
 + *
 +/*
 + * iopen.h
 + *
@@ -335,6 +371,7 @@ Index: linux-stage/fs/ext3/iopen.h
 +extern int ext3_iopen_get_inode(struct inode *inode);
 +extern struct dentry *iopen_connect_dentry(struct dentry *dentry,
 +                                         struct inode *inode, int rehash);
 +extern int ext3_iopen_get_inode(struct inode *inode);
 +extern struct dentry *iopen_connect_dentry(struct dentry *dentry,
 +                                         struct inode *inode, int rehash);
++extern void iopen_d_instantiate(struct dentry *dentry, struct inode * inode);
 +
 +#if !defined(HAVE_D_REHASH_COND) && defined(HAVE___D_REHASH)
 +#define d_rehash_cond(dentry, lock) __d_rehash(dentry, lock)
 +
 +#if !defined(HAVE_D_REHASH_COND) && defined(HAVE___D_REHASH)
 +#define d_rehash_cond(dentry, lock) __d_rehash(dentry, lock)
@@ -343,10 +380,10 @@ Index: linux-stage/fs/ext3/iopen.h
 +#if !defined(HAVE_D_MOVE_LOCKED) && defined(HAVE___D_MOVE)
 +#define d_move_locked(dentry, target) __d_move(dentry, target)
 +#endif
 +#if !defined(HAVE_D_MOVE_LOCKED) && defined(HAVE___D_MOVE)
 +#define d_move_locked(dentry, target) __d_move(dentry, target)
 +#endif
-Index: linux-stage/fs/ext3/namei.c
+Index: linux-2.6.9-67/fs/ext3/namei.c
 ===================================================================
 ===================================================================
---- linux-stage.orig/fs/ext3/namei.c   2005-02-25 14:37:28.975023368 +0200
-+++ linux-stage/fs/ext3/namei.c        2005-02-25 14:46:43.090784968 +0200
+--- linux-2.6.9-67.orig/fs/ext3/namei.c
++++ linux-2.6.9-67/fs/ext3/namei.c
 @@ -37,6 +37,7 @@
  #include <linux/buffer_head.h>
  #include <linux/smp_lock.h>
 @@ -37,6 +37,7 @@
  #include <linux/buffer_head.h>
  #include <linux/smp_lock.h>
@@ -355,7 +392,7 @@ Index: linux-stage/fs/ext3/namei.c
  #include "acl.h"
  
  /*
  #include "acl.h"
  
  /*
-@@ -980,6 +981,9 @@
+@@ -1017,6 +1018,9 @@ static struct dentry *ext3_lookup(struct
        if (dentry->d_name.len > EXT3_NAME_LEN)
                return ERR_PTR(-ENAMETOOLONG);
  
        if (dentry->d_name.len > EXT3_NAME_LEN)
                return ERR_PTR(-ENAMETOOLONG);
  
@@ -365,7 +402,7 @@ Index: linux-stage/fs/ext3/namei.c
        bh = ext3_find_entry(dentry, &de);
        inode = NULL;
        if (bh) {
        bh = ext3_find_entry(dentry, &de);
        inode = NULL;
        if (bh) {
-@@ -990,10 +994,8 @@
+@@ -1027,10 +1031,8 @@ static struct dentry *ext3_lookup(struct
                if (!inode)
                        return ERR_PTR(-EACCES);
        }
                if (!inode)
                        return ERR_PTR(-EACCES);
        }
@@ -378,7 +415,25 @@ Index: linux-stage/fs/ext3/namei.c
  }
  
  
  }
  
  
-@@ -2037,10 +2039,6 @@
+@@ -1669,7 +1671,7 @@ static int ext3_add_nondir(handle_t *han
+       int err = ext3_add_entry(handle, dentry, inode);
+       if (!err) {
+               ext3_mark_inode_dirty(handle, inode);
+-              d_instantiate(dentry, inode);
++              iopen_d_instantiate(dentry, inode);
+               return 0;
+       }
+       ext3_dec_count(handle, inode);
+@@ -1831,7 +1833,7 @@ retry:
+       dir->i_nlink++;
+       ext3_update_dx_flag(dir);
+       ext3_mark_inode_dirty(handle, dir);
+-      d_instantiate(dentry, inode);
++      iopen_d_instantiate(dentry, inode);
+ out_stop:
+       ext3_journal_stop(handle);
+       if (err == -ENOSPC && ext3_should_retry_alloc(dir->i_sb, &retries))
+@@ -2099,10 +2101,6 @@ static int ext3_rmdir (struct inode * di
                              inode->i_nlink);
        inode->i_version++;
        inode->i_nlink = 0;
                              inode->i_nlink);
        inode->i_version++;
        inode->i_nlink = 0;
@@ -387,9 +442,9 @@ Index: linux-stage/fs/ext3/namei.c
 -       * recovery. */
 -      inode->i_size = 0;
        ext3_orphan_add(handle, inode);
 -       * recovery. */
 -      inode->i_size = 0;
        ext3_orphan_add(handle, inode);
-       inode->i_ctime = dir->i_ctime = dir->i_mtime = CURRENT_TIME;
+       inode->i_ctime = dir->i_ctime = dir->i_mtime = CURRENT_TIME_SEC;
        ext3_mark_inode_dirty(handle, inode);
        ext3_mark_inode_dirty(handle, inode);
-@@ -2163,6 +2161,23 @@
+@@ -2225,6 +2223,23 @@ out_stop:
        return err;
  }
  
        return err;
  }
  
@@ -413,7 +468,7 @@ Index: linux-stage/fs/ext3/namei.c
  static int ext3_link (struct dentry * old_dentry,
                struct inode * dir, struct dentry *dentry)
  {
  static int ext3_link (struct dentry * old_dentry,
                struct inode * dir, struct dentry *dentry)
  {
-@@ -2186,7 +2201,8 @@
+@@ -2254,7 +2269,8 @@ retry:
        ext3_inc_count(handle, inode);
        atomic_inc(&inode->i_count);
  
        ext3_inc_count(handle, inode);
        atomic_inc(&inode->i_count);
  
@@ -423,11 +478,11 @@ Index: linux-stage/fs/ext3/namei.c
        ext3_journal_stop(handle);
        if (err == -ENOSPC && ext3_should_retry_alloc(dir->i_sb, &retries))
                goto retry;
        ext3_journal_stop(handle);
        if (err == -ENOSPC && ext3_should_retry_alloc(dir->i_sb, &retries))
                goto retry;
-Index: linux-stage/fs/ext3/super.c
+Index: linux-2.6.9-67/fs/ext3/super.c
 ===================================================================
 ===================================================================
---- linux-stage.orig/fs/ext3/super.c   2005-02-25 14:37:30.987717392 +0200
-+++ linux-stage/fs/ext3/super.c        2005-02-25 14:44:50.495901992 +0200
-@@ -586,6 +586,7 @@
+--- linux-2.6.9-67.orig/fs/ext3/super.c
++++ linux-2.6.9-67/fs/ext3/super.c
+@@ -632,6 +632,7 @@ enum {
        Opt_usrjquota, Opt_grpjquota, Opt_offusrjquota, Opt_offgrpjquota,
        Opt_jqfmt_vfsold, Opt_jqfmt_vfsv0,
        Opt_ignore, Opt_barrier, Opt_err, Opt_resize,
        Opt_usrjquota, Opt_grpjquota, Opt_offusrjquota, Opt_offgrpjquota,
        Opt_jqfmt_vfsold, Opt_jqfmt_vfsv0,
        Opt_ignore, Opt_barrier, Opt_err, Opt_resize,
@@ -435,7 +490,7 @@ Index: linux-stage/fs/ext3/super.c
  };
  
  static match_table_t tokens = {
  };
  
  static match_table_t tokens = {
-@@ -633,6 +634,9 @@
+@@ -678,6 +679,9 @@ static match_table_t tokens = {
        {Opt_ignore, "noquota"},
        {Opt_ignore, "quota"},
        {Opt_ignore, "usrquota"},
        {Opt_ignore, "noquota"},
        {Opt_ignore, "quota"},
        {Opt_ignore, "usrquota"},
@@ -445,7 +500,7 @@ Index: linux-stage/fs/ext3/super.c
        {Opt_barrier, "barrier=%u"},
        {Opt_err, NULL},
        {Opt_resize, "resize"},
        {Opt_barrier, "barrier=%u"},
        {Opt_err, NULL},
        {Opt_resize, "resize"},
-@@ -914,6 +918,18 @@
+@@ -959,6 +963,18 @@ clear_qf_name:
                        else
                                clear_opt(sbi->s_mount_opt, BARRIER);
                        break;
                        else
                                clear_opt(sbi->s_mount_opt, BARRIER);
                        break;
@@ -464,11 +519,11 @@ Index: linux-stage/fs/ext3/super.c
                case Opt_ignore:
                        break;
                case Opt_resize:
                case Opt_ignore:
                        break;
                case Opt_resize:
-Index: linux-stage/include/linux/ext3_fs.h
+Index: linux-2.6.9-67/include/linux/ext3_fs.h
 ===================================================================
 ===================================================================
---- linux-stage.orig/include/linux/ext3_fs.h   2005-02-25 14:37:28.977023064 +0200
-+++ linux-stage/include/linux/ext3_fs.h        2005-02-25 14:49:00.569884968 +0200
-@@ -355,6 +355,8 @@
+--- linux-2.6.9-67.orig/include/linux/ext3_fs.h
++++ linux-2.6.9-67/include/linux/ext3_fs.h
+@@ -355,6 +355,8 @@ struct ext3_inode {
  #define EXT3_MOUNT_POSIX_ACL          0x08000 /* POSIX Access Control Lists */
  #define EXT3_MOUNT_BARRIER            0x10000 /* Use block barriers */
  #define EXT3_MOUNT_RESERVATION                0x20000 /* Preallocation */
  #define EXT3_MOUNT_POSIX_ACL          0x08000 /* POSIX Access Control Lists */
  #define EXT3_MOUNT_BARRIER            0x10000 /* Use block barriers */
  #define EXT3_MOUNT_RESERVATION                0x20000 /* Preallocation */
index 7411c7b..b73c001 100644 (file)
@@ -1,7 +1,7 @@
-Index: linux-stage/fs/ext3/Makefile
+Index: linux-2.6.5-7.311/fs/ext3/Makefile
 ===================================================================
 ===================================================================
---- linux-stage.orig/fs/ext3/Makefile  2005-02-25 14:31:53.151076368 +0200
-+++ linux-stage/fs/ext3/Makefile       2005-02-25 14:41:51.259150120 +0200
+--- linux-2.6.5-7.311.orig/fs/ext3/Makefile
++++ linux-2.6.5-7.311/fs/ext3/Makefile
 @@ -4,7 +4,7 @@
  
  obj-$(CONFIG_EXT3_FS) += ext3.o
 @@ -4,7 +4,7 @@
  
  obj-$(CONFIG_EXT3_FS) += ext3.o
@@ -11,10 +11,10 @@ Index: linux-stage/fs/ext3/Makefile
           ioctl.o namei.o super.o symlink.o hash.o
  
  ext3-$(CONFIG_EXT3_FS_XATTR)   += xattr.o xattr_user.o xattr_trusted.o
           ioctl.o namei.o super.o symlink.o hash.o
  
  ext3-$(CONFIG_EXT3_FS_XATTR)   += xattr.o xattr_user.o xattr_trusted.o
-Index: linux-stage/fs/ext3/inode.c
+Index: linux-2.6.5-7.311/fs/ext3/inode.c
 ===================================================================
 ===================================================================
---- linux-stage.orig/fs/ext3/inode.c   2005-02-25 14:37:30.983718000 +0200
-+++ linux-stage/fs/ext3/inode.c        2005-02-25 14:47:42.069818792 +0200
+--- linux-2.6.5-7.311.orig/fs/ext3/inode.c
++++ linux-2.6.5-7.311/fs/ext3/inode.c
 @@ -37,6 +37,7 @@
  #include <linux/mpage.h>
  #include <linux/uio.h>
 @@ -37,6 +37,7 @@
  #include <linux/mpage.h>
  #include <linux/uio.h>
@@ -23,7 +23,7 @@ Index: linux-stage/fs/ext3/inode.c
  #include "acl.h"
  
  /*
  #include "acl.h"
  
  /*
-@@ -2408,6 +2409,9 @@
+@@ -2419,6 +2420,9 @@ void ext3_read_inode(struct inode * inod
  #endif
        ei->i_rsv_window.rsv_end = EXT3_RESERVE_WINDOW_NOT_ALLOCATED;
  
  #endif
        ei->i_rsv_window.rsv_end = EXT3_RESERVE_WINDOW_NOT_ALLOCATED;
  
@@ -33,11 +33,11 @@ Index: linux-stage/fs/ext3/inode.c
        if (ext3_get_inode_loc(inode, &iloc, 0))
                goto bad_inode;
        bh = iloc.bh;
        if (ext3_get_inode_loc(inode, &iloc, 0))
                goto bad_inode;
        bh = iloc.bh;
-Index: linux-stage/fs/ext3/iopen.c
+Index: linux-2.6.5-7.311/fs/ext3/iopen.c
 ===================================================================
 ===================================================================
---- linux-2.6.5-sles9.orig/fs/ext3/iopen.c     2003-01-30 13:24:37.000000000 +0300
-+++ linux-2.6.5-sles9/fs/ext3/iopen.c  2004-11-09 02:18:27.611913312 +0300
-@@ -0,0 +1,278 @@
+--- /dev/null
++++ linux-2.6.5-7.311/fs/ext3/iopen.c
+@@ -0,0 +1,314 @@
 +/*
 + * linux/fs/ext3/iopen.c
 + *
 +/*
 + * linux/fs/ext3/iopen.c
 + *
@@ -238,6 +238,42 @@ Index: linux-stage/fs/ext3/iopen.c
 +}
 +
 +/*
 +}
 +
 +/*
++ * Similar as d_instantiate() except that it drops the disconnected
++ * dentry if any.
++ */
++void iopen_d_instantiate(struct dentry *dentry, struct inode * inode)
++{
++      struct dentry *dis_dentry;
++
++      /* verify this dentry is really new */
++      assert(dentry->d_inode == NULL);
++      assert(list_empty(&dentry->d_alias));
++
++      spin_lock(&dcache_lock);
++      if (!inode || !test_opt(inode->i_sb, IOPEN) ||
++          list_empty(&inode->i_dentry))
++              goto do_instantiate;
++
++      /* a disconnected dentry has been added in our back,
++       * we have to drop this dentry, see bug 16362/15713*/
++      dis_dentry = list_entry(inode->i_dentry.next, struct dentry, d_alias);
++      spin_lock(&dis_dentry->d_lock);
++      assert(dis_dentry->d_alias.next == &inode->i_dentry);
++      assert(dis_dentry->d_alias.prev == &inode->i_dentry);
++      assert(dis_dentry->d_flags & DCACHE_DISCONNECTED);
++      __d_drop(dis_dentry);
++      list_del_init(&dis_dentry->d_alias);
++      spin_unlock(&dis_dentry->d_lock);
++
++do_instantiate:
++      if (inode)
++              list_add(&dentry->d_alias, &inode->i_dentry);
++      dentry->d_inode = inode;
++      spin_unlock(&dcache_lock);
++      security_d_instantiate(dentry, inode);
++}
++
++/*
 + * These are the special structures for the iopen pseudo directory.
 + */
 +
 + * These are the special structures for the iopen pseudo directory.
 + */
 +
@@ -316,11 +352,11 @@ Index: linux-stage/fs/ext3/iopen.c
 +
 +      return 1;
 +}
 +
 +      return 1;
 +}
-Index: linux-stage/fs/ext3/iopen.h
+Index: linux-2.6.5-7.311/fs/ext3/iopen.h
 ===================================================================
 ===================================================================
---- linux-stage.orig/fs/ext3/iopen.h   2005-02-25 14:41:01.017787968 +0200
-+++ linux-stage/fs/ext3/iopen.h        2005-02-25 14:41:01.045783712 +0200
-@@ -0,0 +1,23 @@
+--- /dev/null
++++ linux-2.6.5-7.311/fs/ext3/iopen.h
+@@ -0,0 +1,24 @@
 +/*
 + * iopen.h
 + *
 +/*
 + * iopen.h
 + *
@@ -336,6 +372,7 @@ Index: linux-stage/fs/ext3/iopen.h
 +extern int ext3_iopen_get_inode(struct inode *inode);
 +extern struct dentry *iopen_connect_dentry(struct dentry *dentry,
 +                                         struct inode *inode, int rehash);
 +extern int ext3_iopen_get_inode(struct inode *inode);
 +extern struct dentry *iopen_connect_dentry(struct dentry *dentry,
 +                                         struct inode *inode, int rehash);
++extern void iopen_d_instantiate(struct dentry *dentry, struct inode * inode);
 +
 +#if !defined(HAVE_D_REHASH_COND) && defined(HAVE___D_REHASH)
 +#define d_rehash_cond(dentry, lock) __d_rehash(dentry, lock)
 +
 +#if !defined(HAVE_D_REHASH_COND) && defined(HAVE___D_REHASH)
 +#define d_rehash_cond(dentry, lock) __d_rehash(dentry, lock)
@@ -344,10 +381,10 @@ Index: linux-stage/fs/ext3/iopen.h
 +#if !defined(HAVE_D_MOVE_LOCKED) && defined(HAVE___D_MOVE)
 +#define d_move_locked(dentry, target) __d_move(dentry, target)
 +#endif
 +#if !defined(HAVE_D_MOVE_LOCKED) && defined(HAVE___D_MOVE)
 +#define d_move_locked(dentry, target) __d_move(dentry, target)
 +#endif
-Index: linux-stage/fs/ext3/namei.c
+Index: linux-2.6.5-7.311/fs/ext3/namei.c
 ===================================================================
 ===================================================================
---- linux-stage.orig/fs/ext3/namei.c   2005-02-25 14:37:28.975023368 +0200
-+++ linux-stage/fs/ext3/namei.c        2005-02-25 14:46:43.090784968 +0200
+--- linux-2.6.5-7.311.orig/fs/ext3/namei.c
++++ linux-2.6.5-7.311/fs/ext3/namei.c
 @@ -37,6 +37,7 @@
  #include <linux/buffer_head.h>
  #include <linux/smp_lock.h>
 @@ -37,6 +37,7 @@
  #include <linux/buffer_head.h>
  #include <linux/smp_lock.h>
@@ -356,7 +393,7 @@ Index: linux-stage/fs/ext3/namei.c
  #include "acl.h"
  
  /*
  #include "acl.h"
  
  /*
-@@ -980,6 +981,9 @@
+@@ -1024,6 +1025,9 @@ static struct dentry *ext3_lookup(struct
        if (dentry->d_name.len > EXT3_NAME_LEN)
                return ERR_PTR(-ENAMETOOLONG);
  
        if (dentry->d_name.len > EXT3_NAME_LEN)
                return ERR_PTR(-ENAMETOOLONG);
  
@@ -366,7 +403,7 @@ Index: linux-stage/fs/ext3/namei.c
        bh = ext3_find_entry(dentry, &de);
        inode = NULL;
        if (bh) {
        bh = ext3_find_entry(dentry, &de);
        inode = NULL;
        if (bh) {
-@@ -990,10 +994,8 @@
+@@ -1034,10 +1038,8 @@ static struct dentry *ext3_lookup(struct
                if (!inode)
                        return ERR_PTR(-EACCES);
        }
                if (!inode)
                        return ERR_PTR(-EACCES);
        }
@@ -379,7 +416,25 @@ Index: linux-stage/fs/ext3/namei.c
  }
  
  
  }
  
  
-@@ -2037,10 +2039,6 @@
+@@ -1653,7 +1655,7 @@ static int ext3_add_nondir(handle_t *han
+       if (!err) {
+               err = ext3_mark_inode_dirty(handle, inode);
+               if (!err) {
+-                      d_instantiate(dentry, inode);
++                      iopen_d_instantiate(dentry, inode);
+                       return 0;
+               }
+       }
+@@ -1814,7 +1816,7 @@ retry:
+       dir->i_nlink++;
+       ext3_update_dx_flag(dir);
+       ext3_mark_inode_dirty(handle, dir);
+-      d_instantiate(dentry, inode);
++      iopen_d_instantiate(dentry, inode);
+ out_stop:
+       ext3_journal_stop(handle);
+       if (err == -ENOSPC && ext3_should_retry_alloc(dir->i_sb, &retries))
+@@ -2075,10 +2077,6 @@ static int ext3_rmdir (struct inode * di
                              inode->i_nlink);
        inode->i_version++;
        inode->i_nlink = 0;
                              inode->i_nlink);
        inode->i_version++;
        inode->i_nlink = 0;
@@ -390,7 +445,7 @@ Index: linux-stage/fs/ext3/namei.c
        ext3_orphan_add(handle, inode);
        inode->i_ctime = dir->i_ctime = dir->i_mtime = CURRENT_TIME;
        ext3_mark_inode_dirty(handle, inode);
        ext3_orphan_add(handle, inode);
        inode->i_ctime = dir->i_ctime = dir->i_mtime = CURRENT_TIME;
        ext3_mark_inode_dirty(handle, inode);
-@@ -2163,6 +2161,23 @@
+@@ -2199,6 +2197,23 @@ out_stop:
        return err;
  }
  
        return err;
  }
  
@@ -414,7 +469,7 @@ Index: linux-stage/fs/ext3/namei.c
  static int ext3_link (struct dentry * old_dentry,
                struct inode * dir, struct dentry *dentry)
  {
  static int ext3_link (struct dentry * old_dentry,
                struct inode * dir, struct dentry *dentry)
  {
-@@ -2186,7 +2201,8 @@
+@@ -2222,7 +2237,8 @@ retry:
        ext3_inc_count(handle, inode);
        atomic_inc(&inode->i_count);
  
        ext3_inc_count(handle, inode);
        atomic_inc(&inode->i_count);
  
@@ -424,11 +479,11 @@ Index: linux-stage/fs/ext3/namei.c
        ext3_journal_stop(handle);
        if (err == -ENOSPC && ext3_should_retry_alloc(dir->i_sb, &retries))
                goto retry;
        ext3_journal_stop(handle);
        if (err == -ENOSPC && ext3_should_retry_alloc(dir->i_sb, &retries))
                goto retry;
-Index: linux-stage/fs/ext3/super.c
+Index: linux-2.6.5-7.311/fs/ext3/super.c
 ===================================================================
 ===================================================================
---- linux-stage.orig/fs/ext3/super.c   2005-02-25 14:37:30.987717392 +0200
-+++ linux-stage/fs/ext3/super.c        2005-02-25 14:44:50.495901992 +0200
-@@ -586,6 +586,7 @@
+--- linux-2.6.5-7.311.orig/fs/ext3/super.c
++++ linux-2.6.5-7.311/fs/ext3/super.c
+@@ -581,6 +581,7 @@ enum {
        Opt_abort, Opt_data_journal, Opt_data_ordered, Opt_data_writeback,
        Opt_ignore, Opt_barrier,
        Opt_err,
        Opt_abort, Opt_data_journal, Opt_data_ordered, Opt_data_writeback,
        Opt_ignore, Opt_barrier,
        Opt_err,
@@ -436,7 +491,7 @@ Index: linux-stage/fs/ext3/super.c
  };
  
  static match_table_t tokens = {
  };
  
  static match_table_t tokens = {
-@@ -633,6 +634,9 @@
+@@ -621,6 +622,9 @@ static match_table_t tokens = {
        {Opt_ignore, "noquota"},
        {Opt_ignore, "quota"},
        {Opt_ignore, "usrquota"},
        {Opt_ignore, "noquota"},
        {Opt_ignore, "quota"},
        {Opt_ignore, "usrquota"},
@@ -446,7 +501,7 @@ Index: linux-stage/fs/ext3/super.c
        {Opt_barrier, "barrier=%u"},
        {Opt_err, NULL}
  };
        {Opt_barrier, "barrier=%u"},
        {Opt_err, NULL}
  };
-@@ -914,6 +918,18 @@
+@@ -823,6 +827,18 @@ static int parse_options (char * options
                        else
                                clear_opt(sbi->s_mount_opt, BARRIER);
                        break;
                        else
                                clear_opt(sbi->s_mount_opt, BARRIER);
                        break;
@@ -465,11 +520,11 @@ Index: linux-stage/fs/ext3/super.c
                case Opt_ignore:
                        break;
                default:
                case Opt_ignore:
                        break;
                default:
-Index: linux-stage/include/linux/ext3_fs.h
+Index: linux-2.6.5-7.311/include/linux/ext3_fs.h
 ===================================================================
 ===================================================================
---- linux-stage.orig/include/linux/ext3_fs.h   2005-02-25 14:37:28.977023064 +0200
-+++ linux-stage/include/linux/ext3_fs.h        2005-02-25 14:49:00.569884968 +0200
-@@ -355,6 +355,8 @@
+--- linux-2.6.5-7.311.orig/include/linux/ext3_fs.h
++++ linux-2.6.5-7.311/include/linux/ext3_fs.h
+@@ -329,6 +329,8 @@ struct ext3_inode {
  #define EXT3_MOUNT_POSIX_ACL          0x08000 /* POSIX Access Control Lists */
  #define EXT3_MOUNT_RESERVATION                0x10000 /* Preallocation */
  #define EXT3_MOUNT_BARRIER            0x20000 /* Use block barriers */
  #define EXT3_MOUNT_POSIX_ACL          0x08000 /* POSIX Access Control Lists */
  #define EXT3_MOUNT_RESERVATION                0x10000 /* Preallocation */
  #define EXT3_MOUNT_BARRIER            0x20000 /* Use block barriers */
index 9b1c2c7..c760129 100644 (file)
@@ -1,8 +1,8 @@
-Index: linux-stage/fs/ext3/iopen.c
+Index: linux-2.6.18-53.1.21/fs/ext3/iopen.c
 ===================================================================
 --- /dev/null
 ===================================================================
 --- /dev/null
-+++ linux-stage/fs/ext3/iopen.c
-@@ -0,0 +1,254 @@
++++ linux-2.6.18-53.1.21/fs/ext3/iopen.c
+@@ -0,0 +1,290 @@
 +/*
 + * linux/fs/ext3/iopen.c
 + *
 +/*
 + * linux/fs/ext3/iopen.c
 + *
@@ -182,6 +182,42 @@ Index: linux-stage/fs/ext3/iopen.c
 +}
 +
 +/*
 +}
 +
 +/*
++ * Similar as d_instantiate() except that it drops the disconnected
++ * dentry if any.
++ */
++void iopen_d_instantiate(struct dentry *dentry, struct inode * inode)
++{
++      struct dentry *dis_dentry;
++
++      /* verify this dentry is really new */
++      assert(dentry->d_inode == NULL);
++      assert(list_empty(&dentry->d_alias));
++
++      spin_lock(&dcache_lock);
++      if (!inode || !test_opt(inode->i_sb, IOPEN) ||
++          list_empty(&inode->i_dentry))
++              goto do_instantiate;
++
++      /* a disconnected dentry has been added in our back,
++       * we have to drop this dentry, see bug 16362/15713*/
++      dis_dentry = list_entry(inode->i_dentry.next, struct dentry, d_alias);
++      spin_lock(&dis_dentry->d_lock);
++      assert(dis_dentry->d_alias.next == &inode->i_dentry);
++      assert(dis_dentry->d_alias.prev == &inode->i_dentry);
++      assert(dis_dentry->d_flags & DCACHE_DISCONNECTED);
++      __d_drop(dis_dentry);
++      list_del_init(&dis_dentry->d_alias);
++      spin_unlock(&dis_dentry->d_lock);
++
++do_instantiate:
++      if (inode)
++              list_add(&dentry->d_alias, &inode->i_dentry);
++      dentry->d_inode = inode;
++      spin_unlock(&dcache_lock);
++      security_d_instantiate(dentry, inode);
++}
++
++/*
 + * These are the special structures for the iopen pseudo directory.
 + */
 +
 + * These are the special structures for the iopen pseudo directory.
 + */
 +
@@ -257,11 +293,11 @@ Index: linux-stage/fs/ext3/iopen.c
 +
 +      return 1;
 +}
 +
 +      return 1;
 +}
-Index: linux-stage/fs/ext3/iopen.h
+Index: linux-2.6.18-53.1.21/fs/ext3/iopen.h
 ===================================================================
 --- /dev/null
 ===================================================================
 --- /dev/null
-+++ linux-stage/fs/ext3/iopen.h
-@@ -0,0 +1,15 @@
++++ linux-2.6.18-53.1.21/fs/ext3/iopen.h
+@@ -0,0 +1,16 @@
 +/*
 + * iopen.h
 + *
 +/*
 + * iopen.h
 + *
@@ -277,10 +313,11 @@ Index: linux-stage/fs/ext3/iopen.h
 +extern int ext3_iopen_get_inode(struct inode *inode);
 +extern struct dentry *iopen_connect_dentry(struct dentry *dentry,
 +                                         struct inode *inode, int rehash);
 +extern int ext3_iopen_get_inode(struct inode *inode);
 +extern struct dentry *iopen_connect_dentry(struct dentry *dentry,
 +                                         struct inode *inode, int rehash);
-Index: linux-stage/fs/ext3/inode.c
++extern void iopen_d_instantiate(struct dentry *dentry, struct inode * inode);
+Index: linux-2.6.18-53.1.21/fs/ext3/inode.c
 ===================================================================
 ===================================================================
---- linux-stage.orig/fs/ext3/inode.c
-+++ linux-stage/fs/ext3/inode.c
+--- linux-2.6.18-53.1.21.orig/fs/ext3/inode.c
++++ linux-2.6.18-53.1.21/fs/ext3/inode.c
 @@ -37,6 +37,7 @@
  #include <linux/mpage.h>
  #include <linux/uio.h>
 @@ -37,6 +37,7 @@
  #include <linux/mpage.h>
  #include <linux/uio.h>
@@ -298,10 +335,10 @@ Index: linux-stage/fs/ext3/inode.c
  
        if (__ext3_get_inode_loc(inode, &iloc, 0))
                goto bad_inode;
  
        if (__ext3_get_inode_loc(inode, &iloc, 0))
                goto bad_inode;
-Index: linux-stage/fs/ext3/super.c
+Index: linux-2.6.18-53.1.21/fs/ext3/super.c
 ===================================================================
 ===================================================================
---- linux-stage.orig/fs/ext3/super.c
-+++ linux-stage/fs/ext3/super.c
+--- linux-2.6.18-53.1.21.orig/fs/ext3/super.c
++++ linux-2.6.18-53.1.21/fs/ext3/super.c
 @@ -677,6 +677,7 @@ enum {
        Opt_usrjquota, Opt_grpjquota, Opt_offusrjquota, Opt_offgrpjquota,
        Opt_jqfmt_vfsold, Opt_jqfmt_vfsv0, Opt_quota, Opt_noquota,
 @@ -677,6 +677,7 @@ enum {
        Opt_usrjquota, Opt_grpjquota, Opt_offusrjquota, Opt_offgrpjquota,
        Opt_jqfmt_vfsold, Opt_jqfmt_vfsv0, Opt_quota, Opt_noquota,
@@ -339,10 +376,10 @@ Index: linux-stage/fs/ext3/super.c
                case Opt_ignore:
                        break;
                case Opt_resize:
                case Opt_ignore:
                        break;
                case Opt_resize:
-Index: linux-stage/fs/ext3/namei.c
+Index: linux-2.6.18-53.1.21/fs/ext3/namei.c
 ===================================================================
 ===================================================================
---- linux-stage.orig/fs/ext3/namei.c
-+++ linux-stage/fs/ext3/namei.c
+--- linux-2.6.18-53.1.21.orig/fs/ext3/namei.c
++++ linux-2.6.18-53.1.21/fs/ext3/namei.c
 @@ -39,6 +39,7 @@
  
  #include "namei.h"
 @@ -39,6 +39,7 @@
  
  #include "namei.h"
@@ -351,7 +388,7 @@ Index: linux-stage/fs/ext3/namei.c
  #include "acl.h"
  
  /*
  #include "acl.h"
  
  /*
-@@ -1013,6 +1014,9 @@ static struct dentry *ext3_lookup(struct
+@@ -1020,6 +1021,9 @@ static struct dentry *ext3_lookup(struct
        if (dentry->d_name.len > EXT3_NAME_LEN)
                return ERR_PTR(-ENAMETOOLONG);
  
        if (dentry->d_name.len > EXT3_NAME_LEN)
                return ERR_PTR(-ENAMETOOLONG);
  
@@ -361,7 +398,7 @@ Index: linux-stage/fs/ext3/namei.c
        bh = ext3_find_entry(dentry, &de);
        inode = NULL;
        if (bh) {
        bh = ext3_find_entry(dentry, &de);
        inode = NULL;
        if (bh) {
-@@ -1028,7 +1032,8 @@ static struct dentry *ext3_lookup(struct
+@@ -1035,7 +1039,8 @@ static struct dentry *ext3_lookup(struct
                if (!inode)
                        return ERR_PTR(-EACCES);
        }
                if (!inode)
                        return ERR_PTR(-EACCES);
        }
@@ -371,7 +408,25 @@ Index: linux-stage/fs/ext3/namei.c
  }
  
  
  }
  
  
-@@ -2077,10 +2082,6 @@ static int ext3_rmdir (struct inode * di
+@@ -1678,7 +1683,7 @@ static int ext3_add_nondir(handle_t *han
+       int err = ext3_add_entry(handle, dentry, inode);
+       if (!err) {
+               ext3_mark_inode_dirty(handle, inode);
+-              d_instantiate(dentry, inode);
++              iopen_d_instantiate(dentry, inode);
+               return 0;
+       }
+       ext3_dec_count(handle, inode);
+@@ -1840,7 +1845,7 @@ retry:
+       dir->i_nlink++;
+       ext3_update_dx_flag(dir);
+       ext3_mark_inode_dirty(handle, dir);
+-      d_instantiate(dentry, inode);
++      iopen_d_instantiate(dentry, inode);
+ out_stop:
+       ext3_journal_stop(handle);
+       if (err == -ENOSPC && ext3_should_retry_alloc(dir->i_sb, &retries))
+@@ -2108,10 +2113,6 @@ static int ext3_rmdir (struct inode * di
                              inode->i_nlink);
        inode->i_version++;
        inode->i_nlink = 0;
                              inode->i_nlink);
        inode->i_version++;
        inode->i_nlink = 0;
@@ -382,7 +437,7 @@ Index: linux-stage/fs/ext3/namei.c
        ext3_orphan_add(handle, inode);
        inode->i_ctime = dir->i_ctime = dir->i_mtime = CURRENT_TIME_SEC;
        ext3_mark_inode_dirty(handle, inode);
        ext3_orphan_add(handle, inode);
        inode->i_ctime = dir->i_ctime = dir->i_mtime = CURRENT_TIME_SEC;
        ext3_mark_inode_dirty(handle, inode);
-@@ -2204,6 +2205,23 @@ out_stop:
+@@ -2235,6 +2236,23 @@ out_stop:
        return err;
  }
  
        return err;
  }
  
@@ -406,7 +461,7 @@ Index: linux-stage/fs/ext3/namei.c
  static int ext3_link (struct dentry * old_dentry,
                struct inode * dir, struct dentry *dentry)
  {
  static int ext3_link (struct dentry * old_dentry,
                struct inode * dir, struct dentry *dentry)
  {
-@@ -2233,7 +2251,8 @@ retry:
+@@ -2264,7 +2282,8 @@ retry:
        ext3_inc_count(handle, inode);
        atomic_inc(&inode->i_count);
  
        ext3_inc_count(handle, inode);
        atomic_inc(&inode->i_count);
  
@@ -416,10 +471,10 @@ Index: linux-stage/fs/ext3/namei.c
        ext3_journal_stop(handle);
        if (err == -ENOSPC && ext3_should_retry_alloc(dir->i_sb, &retries))
                goto retry;
        ext3_journal_stop(handle);
        if (err == -ENOSPC && ext3_should_retry_alloc(dir->i_sb, &retries))
                goto retry;
-Index: linux-stage/fs/ext3/Makefile
+Index: linux-2.6.18-53.1.21/fs/ext3/Makefile
 ===================================================================
 ===================================================================
---- linux-stage.orig/fs/ext3/Makefile
-+++ linux-stage/fs/ext3/Makefile
+--- linux-2.6.18-53.1.21.orig/fs/ext3/Makefile
++++ linux-2.6.18-53.1.21/fs/ext3/Makefile
 @@ -4,7 +4,7 @@
  
  obj-$(CONFIG_EXT3_FS) += ext3.o
 @@ -4,7 +4,7 @@
  
  obj-$(CONFIG_EXT3_FS) += ext3.o
@@ -429,10 +484,10 @@ Index: linux-stage/fs/ext3/Makefile
           ioctl.o namei.o super.o symlink.o hash.o resize.o
  
  ext3-$(CONFIG_EXT3_FS_XATTR)   += xattr.o xattr_user.o xattr_trusted.o
           ioctl.o namei.o super.o symlink.o hash.o resize.o
  
  ext3-$(CONFIG_EXT3_FS_XATTR)   += xattr.o xattr_user.o xattr_trusted.o
-Index: linux-stage/include/linux/ext3_fs.h
+Index: linux-2.6.18-53.1.21/include/linux/ext3_fs.h
 ===================================================================
 ===================================================================
---- linux-stage.orig/include/linux/ext3_fs.h
-+++ linux-stage/include/linux/ext3_fs.h
+--- linux-2.6.18-53.1.21.orig/include/linux/ext3_fs.h
++++ linux-2.6.18-53.1.21/include/linux/ext3_fs.h
 @@ -371,6 +371,8 @@ struct ext3_inode {
  #define EXT3_MOUNT_QUOTA              0x80000 /* Some quota option set */
  #define EXT3_MOUNT_USRQUOTA           0x100000 /* "old" user quota */
 @@ -371,6 +371,8 @@ struct ext3_inode {
  #define EXT3_MOUNT_QUOTA              0x80000 /* Some quota option set */
  #define EXT3_MOUNT_USRQUOTA           0x100000 /* "old" user quota */
index 9b73784..88192a6 100644 (file)
@@ -1,8 +1,8 @@
-Index: linux-2.6.22.15/fs/ext3/iopen.c
+Index: linux-2.6.22.19/fs/ext3/iopen.c
 ===================================================================
 --- /dev/null
 ===================================================================
 --- /dev/null
-+++ linux-2.6.22.15/fs/ext3/iopen.c
-@@ -0,0 +1,256 @@
++++ linux-2.6.22.19/fs/ext3/iopen.c
+@@ -0,0 +1,292 @@
 +/*
 + * linux/fs/ext3/iopen.c
 + *
 +/*
 + * linux/fs/ext3/iopen.c
 + *
@@ -184,6 +184,42 @@ Index: linux-2.6.22.15/fs/ext3/iopen.c
 +}
 +
 +/*
 +}
 +
 +/*
++ * Similar as d_instantiate() except that it drops the disconnected
++ * dentry if any.
++ */
++void iopen_d_instantiate(struct dentry *dentry, struct inode * inode)
++{
++      struct dentry *dis_dentry;
++
++      /* verify this dentry is really new */
++      assert(dentry->d_inode == NULL);
++      assert(list_empty(&dentry->d_alias));
++
++      spin_lock(&dcache_lock);
++      if (!inode || !test_opt(inode->i_sb, IOPEN) ||
++          list_empty(&inode->i_dentry))
++              goto do_instantiate;
++
++      /* a disconnected dentry has been added in our back,
++       * we have to drop this dentry, see bug 16362/15713*/
++      dis_dentry = list_entry(inode->i_dentry.next, struct dentry, d_alias);
++      spin_lock(&dis_dentry->d_lock);
++      assert(dis_dentry->d_alias.next == &inode->i_dentry);
++      assert(dis_dentry->d_alias.prev == &inode->i_dentry);
++      assert(dis_dentry->d_flags & DCACHE_DISCONNECTED);
++      __d_drop(dis_dentry);
++      list_del_init(&dis_dentry->d_alias);
++      spin_unlock(&dis_dentry->d_lock);
++
++do_instantiate:
++      if (inode)
++              list_add(&dentry->d_alias, &inode->i_dentry);
++      dentry->d_inode = inode;
++      spin_unlock(&dcache_lock);
++      security_d_instantiate(dentry, inode);
++}
++
++/*
 + * These are the special structures for the iopen pseudo directory.
 + */
 +
 + * These are the special structures for the iopen pseudo directory.
 + */
 +
@@ -259,11 +295,11 @@ Index: linux-2.6.22.15/fs/ext3/iopen.c
 +
 +      return 1;
 +}
 +
 +      return 1;
 +}
-Index: linux-2.6.22.15/fs/ext3/iopen.h
+Index: linux-2.6.22.19/fs/ext3/iopen.h
 ===================================================================
 --- /dev/null
 ===================================================================
 --- /dev/null
-+++ linux-2.6.22.15/fs/ext3/iopen.h
-@@ -0,0 +1,19 @@
++++ linux-2.6.22.19/fs/ext3/iopen.h
+@@ -0,0 +1,20 @@
 +/*
 + * iopen.h
 + *
 +/*
 + * iopen.h
 + *
@@ -279,14 +315,15 @@ Index: linux-2.6.22.15/fs/ext3/iopen.h
 +extern int ext3_iopen_get_inode(struct inode *inode);
 +extern struct dentry *iopen_connect_dentry(struct dentry *dentry,
 +                                         struct inode *inode, int rehash);
 +extern int ext3_iopen_get_inode(struct inode *inode);
 +extern struct dentry *iopen_connect_dentry(struct dentry *dentry,
 +                                         struct inode *inode, int rehash);
++extern void iopen_d_instantiate(struct dentry *dentry, struct inode * inode);
 +
 +#if !defined(HAVE_D_MOVE_LOCKED) && defined(HAVE___D_MOVE)
 +#define d_move_locked(dentry, target) __d_move(dentry, target)
 +#endif
 +
 +#if !defined(HAVE_D_MOVE_LOCKED) && defined(HAVE___D_MOVE)
 +#define d_move_locked(dentry, target) __d_move(dentry, target)
 +#endif
-Index: linux-2.6.22.15/fs/ext3/inode.c
+Index: linux-2.6.22.19/fs/ext3/inode.c
 ===================================================================
 ===================================================================
---- linux-2.6.22.15.orig/fs/ext3/inode.c
-+++ linux-2.6.22.15/fs/ext3/inode.c
+--- linux-2.6.22.19.orig/fs/ext3/inode.c
++++ linux-2.6.22.19/fs/ext3/inode.c
 @@ -37,6 +37,7 @@
  #include <linux/uio.h>
  #include <linux/bio.h>
 @@ -37,6 +37,7 @@
  #include <linux/uio.h>
  #include <linux/bio.h>
@@ -304,10 +341,10 @@ Index: linux-2.6.22.15/fs/ext3/inode.c
  
        if (__ext3_get_inode_loc(inode, &iloc, 0))
                goto bad_inode;
  
        if (__ext3_get_inode_loc(inode, &iloc, 0))
                goto bad_inode;
-Index: linux-2.6.22.15/fs/ext3/super.c
+Index: linux-2.6.22.19/fs/ext3/super.c
 ===================================================================
 ===================================================================
---- linux-2.6.22.15.orig/fs/ext3/super.c
-+++ linux-2.6.22.15/fs/ext3/super.c
+--- linux-2.6.22.19.orig/fs/ext3/super.c
++++ linux-2.6.22.19/fs/ext3/super.c
 @@ -674,6 +674,7 @@ enum {
        Opt_usrjquota, Opt_grpjquota, Opt_offusrjquota, Opt_offgrpjquota,
        Opt_jqfmt_vfsold, Opt_jqfmt_vfsv0, Opt_quota, Opt_noquota,
 @@ -674,6 +674,7 @@ enum {
        Opt_usrjquota, Opt_grpjquota, Opt_offusrjquota, Opt_offgrpjquota,
        Opt_jqfmt_vfsold, Opt_jqfmt_vfsv0, Opt_quota, Opt_noquota,
@@ -345,10 +382,10 @@ Index: linux-2.6.22.15/fs/ext3/super.c
                case Opt_ignore:
                        break;
                case Opt_resize:
                case Opt_ignore:
                        break;
                case Opt_resize:
-Index: linux-2.6.22.15/fs/ext3/namei.c
+Index: linux-2.6.22.19/fs/ext3/namei.c
 ===================================================================
 ===================================================================
---- linux-2.6.22.15.orig/fs/ext3/namei.c
-+++ linux-2.6.22.15/fs/ext3/namei.c
+--- linux-2.6.22.19.orig/fs/ext3/namei.c
++++ linux-2.6.22.19/fs/ext3/namei.c
 @@ -39,6 +39,7 @@
  
  #include "namei.h"
 @@ -39,6 +39,7 @@
  
  #include "namei.h"
@@ -377,6 +414,24 @@ Index: linux-2.6.22.15/fs/ext3/namei.c
  }
  
  
  }
  
  
+@@ -1693,7 +1698,7 @@ static int ext3_add_nondir(handle_t *han
+       int err = ext3_add_entry(handle, dentry, inode);
+       if (!err) {
+               ext3_mark_inode_dirty(handle, inode);
+-              d_instantiate(dentry, inode);
++              iopen_d_instantiate(dentry, inode);
+               return 0;
+       }
+       drop_nlink(inode);
+@@ -1855,7 +1860,7 @@ retry:
+       inc_nlink(dir);
+       ext3_update_dx_flag(dir);
+       ext3_mark_inode_dirty(handle, dir);
+-      d_instantiate(dentry, inode);
++      iopen_d_instantiate(dentry, inode);
+ out_stop:
+       ext3_journal_stop(handle);
+       if (err == -ENOSPC && ext3_should_retry_alloc(dir->i_sb, &retries))
 @@ -2123,10 +2128,6 @@ static int ext3_rmdir (struct inode * di
                              inode->i_nlink);
        inode->i_version++;
 @@ -2123,10 +2128,6 @@ static int ext3_rmdir (struct inode * di
                              inode->i_nlink);
        inode->i_version++;
@@ -422,10 +477,10 @@ Index: linux-2.6.22.15/fs/ext3/namei.c
        ext3_journal_stop(handle);
        if (err == -ENOSPC && ext3_should_retry_alloc(dir->i_sb, &retries))
                goto retry;
        ext3_journal_stop(handle);
        if (err == -ENOSPC && ext3_should_retry_alloc(dir->i_sb, &retries))
                goto retry;
-Index: linux-2.6.22.15/fs/ext3/Makefile
+Index: linux-2.6.22.19/fs/ext3/Makefile
 ===================================================================
 ===================================================================
---- linux-2.6.22.15.orig/fs/ext3/Makefile
-+++ linux-2.6.22.15/fs/ext3/Makefile
+--- linux-2.6.22.19.orig/fs/ext3/Makefile
++++ linux-2.6.22.19/fs/ext3/Makefile
 @@ -4,7 +4,7 @@
  
  obj-$(CONFIG_EXT3_FS) += ext3.o
 @@ -4,7 +4,7 @@
  
  obj-$(CONFIG_EXT3_FS) += ext3.o
@@ -435,10 +490,10 @@ Index: linux-2.6.22.15/fs/ext3/Makefile
           ioctl.o namei.o super.o symlink.o hash.o resize.o ext3_jbd.o
  
  ext3-$(CONFIG_EXT3_FS_XATTR)   += xattr.o xattr_user.o xattr_trusted.o
           ioctl.o namei.o super.o symlink.o hash.o resize.o ext3_jbd.o
  
  ext3-$(CONFIG_EXT3_FS_XATTR)   += xattr.o xattr_user.o xattr_trusted.o
-Index: linux-2.6.22.15/include/linux/ext3_fs.h
+Index: linux-2.6.22.19/include/linux/ext3_fs.h
 ===================================================================
 ===================================================================
---- linux-2.6.22.15.orig/include/linux/ext3_fs.h
-+++ linux-2.6.22.15/include/linux/ext3_fs.h
+--- linux-2.6.22.19.orig/include/linux/ext3_fs.h
++++ linux-2.6.22.19/include/linux/ext3_fs.h
 @@ -384,6 +384,8 @@ struct ext3_inode {
  #define EXT3_MOUNT_QUOTA              0x80000 /* Some quota option set */
  #define EXT3_MOUNT_USRQUOTA           0x100000 /* "old" user quota */
 @@ -384,6 +384,8 @@ struct ext3_inode {
  #define EXT3_MOUNT_QUOTA              0x80000 /* Some quota option set */
  #define EXT3_MOUNT_USRQUOTA           0x100000 /* "old" user quota */