Whamcloud - gitweb
Branch b1_6
[fs/lustre-release.git] / ldiskfs / kernel_patches / patches / iopen-2.6-fc5.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
-+++ 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
 + *
@@ -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.
 + */
 +
@@ -262,11 +298,11 @@ Index: linux-stage/fs/ext3/iopen.c
 +
 +      return 1;
 +}
-Index: linux-stage/fs/ext3/iopen.h
+Index: linux-2.6.16.54-0.2.5/fs/ext3/iopen.h
 ===================================================================
 --- /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
 + *
@@ -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 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-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>
@@ -307,10 +344,10 @@ Index: linux-stage/fs/ext3/inode.c
  
        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,
@@ -348,10 +385,10 @@ Index: linux-stage/fs/ext3/super.c
                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"
@@ -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++;
@@ -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;
-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
@@ -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
-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 */