Whamcloud - gitweb
Land b1_2 onto HEAD (20040317_2319)
[fs/lustre-release.git] / lustre / kernel_patches / patches / iopen-2.4.21-chaos.patch
index 16bde95..62bd8e1 100644 (file)
@@ -8,11 +8,11 @@
  include/linux/ext3_fs.h            |    2 
  8 files changed, 318 insertions(+), 2 deletions(-)
 
-Index: linux-2.4.21-chaos/Documentation/filesystems/ext2.txt
+Index: linux-ia64/Documentation/filesystems/ext2.txt
 ===================================================================
---- linux-2.4.21-chaos.orig/Documentation/filesystems/ext2.txt 2002-05-08 01:53:59.000000000 +0400
-+++ linux-2.4.21-chaos/Documentation/filesystems/ext2.txt      2003-12-12 16:19:04.000000000 +0300
-@@ -35,6 +35,22 @@
+--- linux-ia64.orig/Documentation/filesystems/ext2.txt 2004-03-17 15:47:15.000000000 -0800
++++ linux-ia64/Documentation/filesystems/ext2.txt      2004-03-17 18:03:15.000000000 -0800
+@@ -35,6 +35,22 @@ resgid=n                    The group ID which may use th
  
  sb=n                          Use alternate superblock at this location.
  
@@ -35,11 +35,11 @@ Index: linux-2.4.21-chaos/Documentation/filesystems/ext2.txt
  grpquota,noquota,quota,usrquota       Quota options are silently ignored by ext2.
  
  
-Index: linux-2.4.21-chaos/fs/ext3/Makefile
+Index: linux-ia64/fs/ext3/Makefile
 ===================================================================
---- linux-2.4.21-chaos.orig/fs/ext3/Makefile   2003-12-12 16:18:36.000000000 +0300
-+++ linux-2.4.21-chaos/fs/ext3/Makefile        2003-12-12 16:19:04.000000000 +0300
-@@ -11,7 +11,7 @@
+--- linux-ia64.orig/fs/ext3/Makefile   2004-03-17 18:03:14.000000000 -0800
++++ linux-ia64/fs/ext3/Makefile        2004-03-17 18:03:15.000000000 -0800
+@@ -11,7 +11,7 @@ O_TARGET := ext3.o
  
  export-objs := ext3-exports.o
  
@@ -48,10 +48,10 @@ Index: linux-2.4.21-chaos/fs/ext3/Makefile
                ioctl.o namei.o super.o symlink.o hash.o ext3-exports.o
  obj-m    := $(O_TARGET)
  
-Index: linux-2.4.21-chaos/fs/ext3/inode.c
+Index: linux-ia64/fs/ext3/inode.c
 ===================================================================
---- linux-2.4.21-chaos.orig/fs/ext3/inode.c    2003-12-12 16:19:02.000000000 +0300
-+++ linux-2.4.21-chaos/fs/ext3/inode.c 2003-12-12 16:19:05.000000000 +0300
+--- linux-ia64.orig/fs/ext3/inode.c    2004-03-17 18:03:15.000000000 -0800
++++ linux-ia64/fs/ext3/inode.c 2004-03-17 18:10:36.000000000 -0800
 @@ -34,6 +34,7 @@
  #include <linux/highuid.h>
  #include <linux/quotaops.h>
@@ -60,7 +60,7 @@ Index: linux-2.4.21-chaos/fs/ext3/inode.c
  
  /*
   * SEARCH_FROM_ZERO forces each block allocation to search from the start
-@@ -2430,6 +2431,9 @@
+@@ -2430,6 +2431,9 @@ void ext3_read_inode(struct inode * inod
        struct buffer_head *bh;
        int block;
        
@@ -70,21 +70,14 @@ Index: linux-2.4.21-chaos/fs/ext3/inode.c
        if(ext3_get_inode_loc(inode, &iloc))
                goto bad_inode;
        bh = iloc.bh;
-Index: linux-2.4.21-chaos/fs/ext3/iopen.c
+Index: linux-ia64/fs/ext3/iopen.c
 ===================================================================
---- linux-2.4.21-chaos.orig/fs/ext3/iopen.c    2003-01-30 13:24:37.000000000 +0300
-+++ linux-2.4.21-chaos/fs/ext3/iopen.c 2003-12-12 16:19:05.000000000 +0300
-@@ -0,0 +1,258 @@
-+/*
-+ * linux/fs/ext3/iopen.c
-+ *
-+ * Special support for open by inode number
-+ *
-+ * Copyright (C) 2001 by Theodore Ts'o (tytso@alum.mit.edu).
-+ *
-+ * This file may be redistributed under the terms of the GNU General
-+ * Public License.
-+ *
+--- linux-ia64.orig/fs/ext3/iopen.c    2004-03-17 18:02:08.000000000 -0800
++++ linux-ia64/fs/ext3/iopen.c 2004-03-17 18:10:58.000000000 -0800
+@@ -8,3 +8,275 @@
+  * This file may be redistributed under the terms of the GNU General
+  * Public License.
+  *
 + *
 + * Invariants:
 + *   - there is only ever a single DCACHE_NFSD_DISCONNECTED dentry alias
@@ -211,13 +204,24 @@ Index: linux-2.4.21-chaos/fs/ext3/iopen.c
 +
 +/* This function is spliced into ext3_lookup and does the move of a
 + * disconnected dentry (if it exists) to a connected dentry.
-+ * Caller must hold dcache_lock.
 + */
-+struct dentry *iopen_connect_dentry(struct dentry *de, struct inode *inode)
++struct dentry *iopen_connect_dentry(struct dentry *dentry, struct inode *inode,
++                                  int rehash)
 +{
 +      struct dentry *tmp, *goal = NULL;
 +      struct list_head *lp;
 +
++      /* verify this dentry is really new */
++      assert(dentry->d_inode == NULL);
++      assert(list_empty(&dentry->d_alias));           /* d_instantiate */
++      if (rehash)
++              assert(list_empty(&dentry->d_hash));    /* d_rehash */
++      assert(list_empty(&dentry->d_subdirs));
++
++      spin_lock(&dcache_lock);
++      if (!inode)
++              goto do_rehash;
++
 +      /* preferrably return a connected dentry */
 +      list_for_each(lp, &inode->i_dentry) {
 +              tmp = list_entry(lp, struct dentry, d_alias);
@@ -231,27 +235,40 @@ Index: linux-2.4.21-chaos/fs/ext3/iopen.c
 +      }
 +
 +      if (!goal)
-+              return NULL;
++              goto do_instantiate;
 +
 +      /* Move the goal to the de hash queue - like d_move() */
 +      goal->d_flags &= ~DCACHE_NFSD_DISCONNECTED;
 +      list_del_init(&goal->d_hash);
 +
 +      list_del(&goal->d_child);
-+      list_del(&de->d_child);
++      list_del(&dentry->d_child);
 +
 +      /* Switch the parents and the names.. */
-+      switch_names(goal, de);
-+      do_switch(goal->d_parent, de->d_parent);
-+      do_switch(goal->d_name.len, de->d_name.len);
-+      do_switch(goal->d_name.hash, de->d_name.hash);
++      switch_names(goal, dentry);
++      do_switch(goal->d_parent, dentry->d_parent);
++      do_switch(goal->d_name.len, dentry->d_name.len);
++      do_switch(goal->d_name.hash, dentry->d_name.hash);
 +
 +      /* And add them back to the (new) parent lists */
 +      list_add(&goal->d_child, &goal->d_parent->d_subdirs);
-+      list_add(&de->d_child, &de->d_parent->d_subdirs);
++      list_add(&dentry->d_child, &dentry->d_parent->d_subdirs);
 +      __d_rehash(goal, 0);
++      spin_unlock(&dcache_lock);
++      iput(inode);
 +
 +      return goal;
++
++      /* d_add(), but don't drop dcache_lock before adding dentry to inode */
++do_instantiate:
++      list_add(&dentry->d_alias, &inode->i_dentry);   /* d_instantiate */
++      dentry->d_inode = inode;
++do_rehash:
++      if (rehash)
++              __d_rehash(dentry, 0);                  /* d_rehash */
++      spin_unlock(&dcache_lock);
++
++      return NULL;
 +}
 +
 +/*
@@ -333,10 +350,10 @@ Index: linux-2.4.21-chaos/fs/ext3/iopen.c
 +
 +      return 1;
 +}
-Index: linux-2.4.21-chaos/fs/ext3/iopen.h
+Index: linux-ia64/fs/ext3/iopen.h
 ===================================================================
---- linux-2.4.21-chaos.orig/fs/ext3/iopen.h    2003-01-30 13:24:37.000000000 +0300
-+++ linux-2.4.21-chaos/fs/ext3/iopen.h 2003-12-12 16:19:05.000000000 +0300
+--- linux-ia64.orig/fs/ext3/iopen.h    2004-03-17 15:47:15.000000000 -0800
++++ linux-ia64/fs/ext3/iopen.h 2004-03-17 18:03:15.000000000 -0800
 @@ -0,0 +1,15 @@
 +/*
 + * iopen.h
@@ -351,12 +368,12 @@ Index: linux-2.4.21-chaos/fs/ext3/iopen.h
 +
 +extern int ext3_check_for_iopen(struct inode *dir, struct dentry *dentry);
 +extern int ext3_iopen_get_inode(struct inode *inode);
-+extern struct dentry *iopen_connect_dentry(struct dentry *de,
-+                                         struct inode *inode);
-Index: linux-2.4.21-chaos/fs/ext3/namei.c
++extern struct dentry *iopen_connect_dentry(struct dentry *dentry,
++                                         struct inode *inode, int rehash);
+Index: linux-ia64/fs/ext3/namei.c
 ===================================================================
---- linux-2.4.21-chaos.orig/fs/ext3/namei.c    2003-12-12 16:18:59.000000000 +0300
-+++ linux-2.4.21-chaos/fs/ext3/namei.c 2003-12-12 16:19:05.000000000 +0300
+--- linux-ia64.orig/fs/ext3/namei.c    2004-03-17 18:03:15.000000000 -0800
++++ linux-ia64/fs/ext3/namei.c 2004-03-17 18:10:35.000000000 -0800
 @@ -36,7 +36,7 @@
  #include <linux/string.h>
  #include <linux/locks.h>
@@ -366,12 +383,7 @@ Index: linux-2.4.21-chaos/fs/ext3/namei.c
  
  /*
   * define how far ahead to read directories while searching them.
-@@ -922,10 +922,14 @@
-       struct inode * inode;
-       struct ext3_dir_entry_2 * de;
-       struct buffer_head * bh;
-+      struct dentry *alternate = NULL;
+@@ -932,6 +932,9 @@ static struct dentry *ext3_lookup(struct
        if (dentry->d_name.len > EXT3_NAME_LEN)
                return ERR_PTR(-ENAMETOOLONG);
  
@@ -381,41 +393,67 @@ Index: linux-2.4.21-chaos/fs/ext3/namei.c
        bh = ext3_find_entry(dentry, &de);
        inode = NULL;
        if (bh) {
-@@ -943,7 +948,28 @@
+@@ -943,8 +946,8 @@ static struct dentry *ext3_lookup(struct
                        return ERR_PTR(-EACCES);
                }
        }
 -      d_add(dentry, inode);
+-      return NULL;
 +
-+      /* verify this dentry is really new */
-+      assert(!dentry->d_inode);
-+      assert(list_empty(&dentry->d_alias));           /* d_instantiate */
-+      assert(list_empty(&dentry->d_hash));            /* d_rehash */
-+      assert(list_empty(&dentry->d_subdirs));
-+
-+      spin_lock(&dcache_lock);
-+      if (inode && (alternate = iopen_connect_dentry(dentry, inode))) {
-+              spin_unlock(&dcache_lock);
-+              iput(inode);
-+              return alternate;
++      return iopen_connect_dentry(dentry, inode, 1);
+ }
+ #define S_SHIFT 12
+@@ -1935,10 +1938,6 @@ static int ext3_rmdir (struct inode * di
+                             inode->i_nlink);
+       inode->i_version = ++event;
+       inode->i_nlink = 0;
+-      /* There's no need to set i_disksize: the fact that i_nlink is
+-       * zero will ensure that the right thing happens during any
+-       * recovery. */
+-      inode->i_size = 0;
+       ext3_orphan_add(handle, inode);
+       dir->i_nlink--;
+       inode->i_ctime = dir->i_ctime = dir->i_mtime = CURRENT_TIME;
+@@ -2057,6 +2056,23 @@ out_stop:
+       return err;
+ }
++/* Like ext3_add_nondir() except for call to iopen_connect_dentry */
++static int ext3_add_link(handle_t *handle, struct dentry *dentry,
++                       struct inode *inode)
++{
++      int err = ext3_add_entry(handle, dentry, inode);
++      if (!err) {
++              err = ext3_mark_inode_dirty(handle, inode);
++              if (err == 0) {
++                      (void)iopen_connect_dentry(dentry, inode, 0);
++                      return 0;
++              }
 +      }
++      ext3_dec_count(handle, inode);
++      iput(inode);
++      return err;
++}
 +
-+      /* d_add(), but don't drop dcache_lock before adding dentry to inode */
-+      if (inode)                                      /* d_instantiate */
-+              list_add(&dentry->d_alias, &inode->i_dentry);
-+      dentry->d_inode = inode;
-+
-+      __d_rehash(dentry, 0);                          /* d_rehash */
-+      spin_unlock(&dcache_lock);
-+
-       return NULL;
- }
+ static int ext3_link (struct dentry * old_dentry,
+               struct inode * dir, struct dentry *dentry)
+ {
+@@ -2084,7 +2100,8 @@ static int ext3_link (struct dentry * ol
+       ext3_inc_count(handle, inode);
+       atomic_inc(&inode->i_count);
  
-Index: linux-2.4.21-chaos/fs/ext3/super.c
+-      err = ext3_add_nondir(handle, dentry, inode);
++      err = ext3_add_link(handle, dentry, inode);
++      ext3_orphan_del(handle, inode);
+       ext3_journal_stop(handle, dir);
+       return err;
+ }
+Index: linux-ia64/fs/ext3/super.c
 ===================================================================
---- linux-2.4.21-chaos.orig/fs/ext3/super.c    2003-12-12 16:18:51.000000000 +0300
-+++ linux-2.4.21-chaos/fs/ext3/super.c 2003-12-12 16:19:05.000000000 +0300
-@@ -890,6 +890,18 @@
+--- linux-ia64.orig/fs/ext3/super.c    2004-03-17 18:03:14.000000000 -0800
++++ linux-ia64/fs/ext3/super.c 2004-03-17 18:10:35.000000000 -0800
+@@ -891,6 +891,18 @@ static int parse_options (char * options
                         || !strcmp (this_char, "quota")
                         || !strcmp (this_char, "usrquota"))
                        /* Don't do anything ;-) */ ;
@@ -434,11 +472,11 @@ Index: linux-2.4.21-chaos/fs/ext3/super.c
                else if (!strcmp (this_char, "journal")) {
                        /* @@@ FIXME */
                        /* Eventually we will want to be able to create
-Index: linux-2.4.21-chaos/include/linux/ext3_fs.h
+Index: linux-ia64/include/linux/ext3_fs.h
 ===================================================================
---- linux-2.4.21-chaos.orig/include/linux/ext3_fs.h    2003-12-12 16:19:01.000000000 +0300
-+++ linux-2.4.21-chaos/include/linux/ext3_fs.h 2003-12-12 16:19:05.000000000 +0300
-@@ -328,6 +328,8 @@
+--- linux-ia64.orig/include/linux/ext3_fs.h    2004-03-17 18:03:15.000000000 -0800
++++ linux-ia64/include/linux/ext3_fs.h 2004-03-17 18:03:15.000000000 -0800
+@@ -328,6 +328,8 @@ struct ext3_inode {
  #define EXT3_MOUNT_XATTR_USER         0x4000  /* Extended user attributes */
  #define EXT3_MOUNT_POSIX_ACL          0x8000  /* POSIX Access Control Lists */
  #define EXT3_MOUNT_ASYNCDEL           0x20000 /* Delayed deletion */