Whamcloud - gitweb
b=19058
[fs/lustre-release.git] / ldiskfs / kernel_patches / patches / iopen-2.6.22-vanilla.patch
index ce80837..fc8e0f6 100644 (file)
@@ -1,8 +1,8 @@
-Index: linux-2.6.16.27-0.9/fs/ext3/iopen.c
+Index: linux-2.6.22.19/fs/ext3/iopen.c
 ===================================================================
---- /dev/null  1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6.16.27-0.9/fs/ext3/iopen.c        2007-06-29 08:33:12.000000000 +0200
-@@ -0,0 +1,256 @@
+--- /dev/null
++++ linux-2.6.22.19/fs/ext3/iopen.c
+@@ -0,0 +1,293 @@
 +/*
 + * linux/fs/ext3/iopen.c
 + *
@@ -165,7 +165,7 @@ Index: linux-2.6.16.27-0.9/fs/ext3/iopen.c
 +      security_d_instantiate(goal, inode);
 +      __d_drop(dentry);
 +      d_rehash_cond(dentry, 0);
-+      __d_move(goal, dentry);
++      d_move_locked(goal, dentry);
 +      spin_unlock(&dcache_lock);
 +      iput(inode);
 +
@@ -184,6 +184,42 @@ Index: linux-2.6.16.27-0.9/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.
 + */
 +
@@ -249,6 +285,7 @@ Index: linux-2.6.16.27-0.9/fs/ext3/iopen.c
 +      inode->i_ctime = CURRENT_TIME;
 +      inode->i_mtime = CURRENT_TIME;
 +      EXT3_I(inode)->i_dtime = 0;
++      EXT3_I(inode)->i_file_acl = 0;
 +      inode->i_blocks = 0;
 +      inode->i_version = 1;
 +      inode->i_generation = 0;
@@ -259,11 +296,11 @@ Index: linux-2.6.16.27-0.9/fs/ext3/iopen.c
 +
 +      return 1;
 +}
-Index: linux-2.6.16.27-0.9/fs/ext3/iopen.h
+Index: linux-2.6.22.19/fs/ext3/iopen.h
 ===================================================================
---- /dev/null  1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6.16.27-0.9/fs/ext3/iopen.h        2007-06-29 08:24:49.000000000 +0200
-@@ -0,0 +1,15 @@
+--- /dev/null
++++ linux-2.6.22.19/fs/ext3/iopen.h
+@@ -0,0 +1,20 @@
 +/*
 + * iopen.h
 + *
@@ -279,10 +316,15 @@ Index: linux-2.6.16.27-0.9/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);
-Index: linux-2.6.16.27-0.9/fs/ext3/inode.c
++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
+Index: linux-2.6.22.19/fs/ext3/inode.c
 ===================================================================
---- linux-2.6.16.27-0.9.orig/fs/ext3/inode.c   2007-06-29 08:24:48.000000000 +0200
-+++ linux-2.6.16.27-0.9/fs/ext3/inode.c        2007-06-29 08:24:52.000000000 +0200
+--- 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>
@@ -291,7 +333,7 @@ Index: linux-2.6.16.27-0.9/fs/ext3/inode.c
  #include "acl.h"
  
  static int ext3_writepage_trans_blocks(struct inode *inode);
-@@ -2448,6 +2449,8 @@ void ext3_read_inode(struct inode * inod
+@@ -2604,6 +2605,8 @@ void ext3_read_inode(struct inode * inod
        ei->i_default_acl = EXT3_ACL_NOT_CACHED;
  #endif
        ei->i_block_alloc_info = NULL;
@@ -300,11 +342,11 @@ Index: linux-2.6.16.27-0.9/fs/ext3/inode.c
  
        if (__ext3_get_inode_loc(inode, &iloc, 0))
                goto bad_inode;
-Index: linux-2.6.16.27-0.9/fs/ext3/super.c
+Index: linux-2.6.22.19/fs/ext3/super.c
 ===================================================================
---- linux-2.6.16.27-0.9.orig/fs/ext3/super.c   2007-06-29 08:24:48.000000000 +0200
-+++ linux-2.6.16.27-0.9/fs/ext3/super.c        2007-06-29 08:24:52.000000000 +0200
-@@ -678,6 +678,7 @@ enum {
+--- 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,
        Opt_ignore, Opt_barrier, Opt_err, Opt_resize, Opt_usrquota,
@@ -312,7 +354,7 @@ Index: linux-2.6.16.27-0.9/fs/ext3/super.c
        Opt_grpquota
  };
  
-@@ -726,6 +727,9 @@ static match_table_t tokens = {
+@@ -723,6 +724,9 @@ static match_table_t tokens = {
        {Opt_noquota, "noquota"},
        {Opt_quota, "quota"},
        {Opt_usrquota, "usrquota"},
@@ -322,7 +364,7 @@ Index: linux-2.6.16.27-0.9/fs/ext3/super.c
        {Opt_barrier, "barrier=%u"},
        {Opt_err, NULL},
        {Opt_resize, "resize"},
-@@ -1040,6 +1044,18 @@ clear_qf_name:
+@@ -1038,6 +1042,18 @@ clear_qf_name:
                        else
                                clear_opt(sbi->s_mount_opt, BARRIER);
                        break;
@@ -341,10 +383,10 @@ Index: linux-2.6.16.27-0.9/fs/ext3/super.c
                case Opt_ignore:
                        break;
                case Opt_resize:
-Index: linux-2.6.16.27-0.9/fs/ext3/namei.c
+Index: linux-2.6.22.19/fs/ext3/namei.c
 ===================================================================
---- linux-2.6.16.27-0.9.orig/fs/ext3/namei.c   2007-06-29 08:24:47.000000000 +0200
-+++ linux-2.6.16.27-0.9/fs/ext3/namei.c        2007-06-29 08:24:49.000000000 +0200
+--- 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"
@@ -353,7 +395,7 @@ Index: linux-2.6.16.27-0.9/fs/ext3/namei.c
  #include "acl.h"
  
  /*
-@@ -1004,6 +1005,9 @@ static struct dentry *ext3_lookup(struct
+@@ -1047,6 +1048,9 @@ static struct dentry *ext3_lookup(struct
        if (dentry->d_name.len > EXT3_NAME_LEN)
                return ERR_PTR(-ENAMETOOLONG);
  
@@ -363,16 +405,35 @@ Index: linux-2.6.16.27-0.9/fs/ext3/namei.c
        bh = ext3_find_entry(dentry, &de);
        inode = NULL;
        if (bh) {
-@@ -1014,7 +1018,7 @@ static struct dentry *ext3_lookup(struct
+@@ -1062,7 +1066,8 @@ static struct dentry *ext3_lookup(struct
                if (!inode)
                        return ERR_PTR(-EACCES);
        }
 -      return d_splice_alias(inode, dentry);
-+      return iopen_connect_dentry(dentry, inode, 1);
++
++      return iopen_connect_dentry(dentry, inode, 1);
  }
  
  
-@@ -2058,10 +2062,6 @@ static int ext3_rmdir (struct inode * di
+@@ -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++;
        clear_nlink(inode);
@@ -383,7 +444,7 @@ Index: linux-2.6.16.27-0.9/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);
-@@ -2185,6 +2185,23 @@ out_stop:
+@@ -2250,6 +2251,23 @@ out_stop:
        return err;
  }
  
@@ -407,8 +468,8 @@ Index: linux-2.6.16.27-0.9/fs/ext3/namei.c
  static int ext3_link (struct dentry * old_dentry,
                struct inode * dir, struct dentry *dentry)
  {
-@@ -2208,7 +2225,8 @@ retry:
-       ext3_inc_count(handle, inode);
+@@ -2279,7 +2297,8 @@ retry:
+       inc_nlink(inode);
        atomic_inc(&inode->i_count);
  
 -      err = ext3_add_nondir(handle, dentry, inode);
@@ -417,10 +478,10 @@ Index: linux-2.6.16.27-0.9/fs/ext3/namei.c
        ext3_journal_stop(handle);
        if (err == -ENOSPC && ext3_should_retry_alloc(dir->i_sb, &retries))
                goto retry;
-Index: linux-2.6.16.27-0.9/fs/ext3/Makefile
+Index: linux-2.6.22.19/fs/ext3/Makefile
 ===================================================================
---- linux-2.6.16.27-0.9.orig/fs/ext3/Makefile  2007-03-13 00:56:52.000000000 +0100
-+++ linux-2.6.16.27-0.9/fs/ext3/Makefile       2007-06-29 08:24:49.000000000 +0200
+--- 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
@@ -430,11 +491,11 @@ Index: linux-2.6.16.27-0.9/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
-Index: linux-2.6.16.27-0.9/include/linux/ext3_fs.h
+Index: linux-2.6.22.19/include/linux/ext3_fs.h
 ===================================================================
---- linux-2.6.16.27-0.9.orig/include/linux/ext3_fs.h   2007-06-29 08:24:47.000000000 +0200
-+++ linux-2.6.16.27-0.9/include/linux/ext3_fs.h        2007-06-29 08:24:49.000000000 +0200
-@@ -375,6 +375,8 @@ struct ext3_inode {
+--- 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 */
  #define EXT3_MOUNT_GRPQUOTA           0x200000 /* "old" group quota */