Whamcloud - gitweb
Fixed the patch for intent_release. After this fix lock refs are in order now.
authoramrutjoshi <amrutjoshi>
Mon, 24 Mar 2003 15:52:19 +0000 (15:52 +0000)
committeramrutjoshi <amrutjoshi>
Mon, 24 Mar 2003 15:52:19 +0000 (15:52 +0000)
Most of the metadata ops are working.

lustre/kernel_patches/patches/lustre-2.5.63.patch

index 470e7c7..40e6a90 100644 (file)
@@ -1,19 +1,19 @@
  arch/um/kernel/mem.c   |   18 ++++++
  fs/dcache.c            |   12 +++-
- fs/namei.c             |  135 ++++++++++++++++++++++++++++++++++++++-----------
+ fs/namei.c             |  132 ++++++++++++++++++++++++++++++++++++++-----------
  fs/namespace.c         |    1 
  fs/nfsd/vfs.c          |    2 
- fs/open.c              |   28 +++++++++-
+ fs/open.c              |   39 ++++++++++++--
  fs/stat.c              |    2 
  fs/sysfs/inode.c       |    2 
  include/linux/dcache.h |   28 ++++++++++
- include/linux/fs.h     |   20 ++++++-
+ include/linux/fs.h     |   20 +++++++
  include/linux/namei.h  |    3 -
  include/linux/slab.h   |    1 
  kernel/ksyms.c         |    7 ++
  mm/slab.c              |    5 +
  net/unix/af_unix.c     |    2 
- 15 files changed, 227 insertions(+), 39 deletions(-)
+ 15 files changed, 231 insertions(+), 43 deletions(-)
 
 --- linux-2.5.63-nointent/arch/um/kernel/mem.c~lustre-2.5.63   Tue Mar 18 15:02:10 2003
 +++ linux-2.5.63-nointent-root/arch/um/kernel/mem.c    Tue Mar 18 15:02:10 2003
@@ -50,7 +50,7 @@
  }
  
 --- linux-2.5.63-nointent/fs/namei.c~lustre-2.5.63     Tue Mar 18 15:02:10 2003
-+++ linux-2.5.63-nointent-root/fs/namei.c      Fri Mar 21 21:10:41 2003
++++ linux-2.5.63-nointent-root/fs/namei.c      Mon Mar 24 17:08:18 2003
 @@ -101,6 +101,14 @@
   * any extra contention...
   */
  /* In order to reduce some races, while at the same time doing additional
   * checking and hopefully speeding things up, we copy filenames to the
   * kernel data space before using them..
-@@ -265,6 +273,9 @@ int deny_write_access(struct file * file
- void path_release(struct nameidata *nd)
- {
-+        if (nd->dentry && nd->dentry->d_op && 
-+            nd->dentry->d_op->d_intent_release)
-+                nd->dentry->d_op->d_intent_release(nd->dentry, &nd->it);
-       dput(nd->dentry);
-       mntput(nd->mnt);
- }
-@@ -273,10 +284,18 @@ void path_release(struct nameidata *nd)
+@@ -273,10 +281,18 @@ void path_release(struct nameidata *nd)
   * Internal lookup() using the new generic dcache.
   * SMP-safe
   */
@@ -96,7 +86,7 @@
        if (dentry && dentry->d_op && dentry->d_op->d_revalidate) {
                if (!dentry->d_op->d_revalidate(dentry, flags) && !d_invalidate(dentry)) {
                        dput(dentry);
-@@ -330,7 +349,7 @@ ok:
+@@ -330,7 +346,7 @@ ok:
   * make sure that nobody added the entry to the dcache in the meantime..
   * SMP-safe
   */
  {
        struct dentry * result;
        struct inode *dir = parent->d_inode;
-@@ -348,7 +367,10 @@ static struct dentry * real_lookup(struc
+@@ -348,7 +364,10 @@ static struct dentry * real_lookup(struc
                struct dentry * dentry = d_alloc(parent, name);
                result = ERR_PTR(-ENOMEM);
                if (dentry) {
                        if (result)
                                dput(dentry);
                        else {
-@@ -370,6 +392,12 @@ static struct dentry * real_lookup(struc
+@@ -370,6 +389,12 @@ static struct dentry * real_lookup(struc
                        dput(result);
                        result = ERR_PTR(-ENOENT);
                }
        }
        return result;
  }
-@@ -402,6 +430,7 @@ static inline int do_follow_link(struct 
+@@ -402,6 +427,7 @@ static inline int do_follow_link(struct 
        current->link_count--;
        return err;
  loop:
        path_release(nd);
        return err;
  }
-@@ -447,15 +476,26 @@ static int follow_mount(struct vfsmount 
+@@ -447,15 +473,26 @@ static int follow_mount(struct vfsmount 
        return res;
  }
  
                dput(*dentry);
                mntput(mounted->mnt_parent);
                *dentry = dget(mounted->mnt_root);
-@@ -467,7 +507,7 @@ static inline int __follow_down(struct v
+@@ -467,7 +504,7 @@ static inline int __follow_down(struct v
  
  int follow_down(struct vfsmount **mnt, struct dentry **dentry)
  {
  }
   
  static inline void follow_dotdot(struct vfsmount **mnt, struct dentry **dentry)
-@@ -531,7 +571,7 @@ done:
+@@ -531,7 +568,7 @@ done:
        return 0;
  
  need_lookup:
        if (IS_ERR(dentry))
                goto fail;
        goto done;
-@@ -665,7 +705,7 @@ int link_path_walk(const char * name, st
+@@ -665,7 +702,7 @@ int link_path_walk(const char * name, st
                        nd->dentry = next.dentry;
                }
                err = -ENOTDIR; 
                        break;
                continue;
                /* here ends the main loop */
-@@ -716,7 +756,8 @@ last_component:
+@@ -716,7 +753,8 @@ last_component:
                        break;
                if (lookup_flags & LOOKUP_DIRECTORY) {
                        err = -ENOTDIR; 
                                break;
                }
                goto return_base;
-@@ -735,6 +776,7 @@ out_dput:
+@@ -735,6 +773,7 @@ out_dput:
                dput(next.dentry);
                break;
        }
        path_release(nd);
  return_err:
        return err;
-@@ -857,7 +899,8 @@ int path_lookup(const char *name, unsign
+@@ -857,7 +896,8 @@ int path_lookup(const char *name, unsign
   * needs parent already locked. Doesn't follow mounts.
   * SMP-safe.
   */
  {
        struct dentry * dentry;
        struct inode *inode;
-@@ -880,13 +923,16 @@ struct dentry * lookup_hash(struct qstr 
+@@ -880,13 +920,16 @@ struct dentry * lookup_hash(struct qstr 
                        goto out;
        }
  
                if (!dentry) {
                        dentry = new;
                        security_inode_post_lookup(inode, dentry);
-@@ -898,7 +944,7 @@ out:
+@@ -898,7 +941,7 @@ out:
  }
  
  /* SMP-safe */
  {
        unsigned long hash;
        struct qstr this;
-@@ -918,11 +964,16 @@ struct dentry * lookup_one_len(const cha
+@@ -918,11 +961,16 @@ struct dentry * lookup_one_len(const cha
        }
        this.hash = end_name_hash(hash);
  
  /*
   *    namei()
   *
-@@ -1224,6 +1275,9 @@ int open_namei(const char * pathname, in
+@@ -1224,6 +1272,9 @@ int open_namei(const char * pathname, in
        /*
         * Create - we need to know the parent.
         */
        error = path_lookup(pathname, LOOKUP_PARENT, nd);
        if (error)
                return error;
-@@ -1239,7 +1293,7 @@ int open_namei(const char * pathname, in
+@@ -1239,7 +1290,7 @@ int open_namei(const char * pathname, in
  
        dir = nd->dentry;
        down(&dir->d_inode->i_sem);
  
  do_last:
        error = PTR_ERR(dentry);
-@@ -1247,7 +1301,8 @@ do_last:
+@@ -1247,7 +1298,8 @@ do_last:
                up(&dir->d_inode->i_sem);
                goto exit;
        }
        /* Negative dentry, just create the file */
        if (!dentry->d_inode) {
                if (!IS_POSIXACL(dir->d_inode))
-@@ -1277,7 +1332,7 @@ do_last:
+@@ -1277,7 +1329,7 @@ do_last:
                error = -ELOOP;
                if (flag & O_NOFOLLOW)
                        goto exit_dput;
        }
        error = -ENOENT;
        if (!dentry->d_inode)
-@@ -1297,8 +1352,10 @@ ok:
+@@ -1297,8 +1349,10 @@ ok:
        return 0;
  
  exit_dput:
        path_release(nd);
        return error;
  
-@@ -1320,7 +1377,12 @@ do_link:
+@@ -1320,7 +1374,12 @@ do_link:
        if (error)
                goto exit_dput;
        UPDATE_ATIME(dentry->d_inode);
        dput(dentry);
        if (error)
                return error;
-@@ -1342,7 +1404,7 @@ do_link:
+@@ -1342,7 +1401,7 @@ do_link:
        }
        dir = nd->dentry;
        down(&dir->d_inode->i_sem);
        putname(nd->last.name);
        goto do_last;
  }
-@@ -1356,7 +1418,7 @@ static struct dentry *lookup_create(stru
+@@ -1356,7 +1415,7 @@ static struct dentry *lookup_create(stru
        dentry = ERR_PTR(-EEXIST);
        if (nd->last_type != LAST_NORM)
                goto fail;
        if (IS_ERR(dentry))
                goto fail;
        if (!is_dir && nd->last.name[nd->last.len] && !dentry->d_inode)
-@@ -1588,7 +1650,7 @@ asmlinkage long sys_rmdir(const char * p
+@@ -1588,7 +1647,7 @@ asmlinkage long sys_rmdir(const char * p
                        goto exit1;
        }
        down(&nd.dentry->d_inode->i_sem);
        error = PTR_ERR(dentry);
        if (!IS_ERR(dentry)) {
                error = vfs_rmdir(nd.dentry->d_inode, dentry);
-@@ -1654,8 +1716,18 @@ asmlinkage long sys_unlink(const char * 
+@@ -1654,8 +1713,18 @@ asmlinkage long sys_unlink(const char * 
        error = -EISDIR;
        if (nd.last_type != LAST_NORM)
                goto exit1;
        error = PTR_ERR(dentry);
        if (!IS_ERR(dentry)) {
                /* Why not before? Because we want correct error value */
-@@ -1859,7 +1931,8 @@ exit:
+@@ -1859,7 +1928,8 @@ exit:
   *       locking].
   */
  int vfs_rename_dir(struct inode *old_dir, struct dentry *old_dentry,
  {
        int error = 0;
        struct inode *target;
-@@ -1887,6 +1960,7 @@ int vfs_rename_dir(struct inode *old_dir
+@@ -1887,6 +1957,7 @@ int vfs_rename_dir(struct inode *old_dir
                error = -EBUSY;
        else 
                error = old_dir->i_op->rename(old_dir, old_dentry, new_dir, new_dentry);
        if (target) {
                if (!error)
                        target->i_flags |= S_DEAD;
-@@ -1904,7 +1978,8 @@ int vfs_rename_dir(struct inode *old_dir
+@@ -1904,7 +1975,8 @@ int vfs_rename_dir(struct inode *old_dir
  }
  
  int vfs_rename_other(struct inode *old_dir, struct dentry *old_dentry,
  {
        struct inode *target;
        int error;
-@@ -1921,6 +1996,7 @@ int vfs_rename_other(struct inode *old_d
+@@ -1921,6 +1993,7 @@ int vfs_rename_other(struct inode *old_d
                error = -EBUSY;
        else
                error = old_dir->i_op->rename(old_dir, old_dentry, new_dir, new_dentry);
        if (!error) {
                /* The following d_move() should become unconditional */
                if (!(old_dir->i_sb->s_type->fs_flags & FS_ODD_RENAME))
-@@ -1934,7 +2010,8 @@ int vfs_rename_other(struct inode *old_d
+@@ -1934,7 +2007,8 @@ int vfs_rename_other(struct inode *old_d
  }
  
  int vfs_rename(struct inode *old_dir, struct dentry *old_dentry,
  {
        int error;
        int is_dir = S_ISDIR(old_dentry->d_inode->i_mode);
-@@ -1960,9 +2037,9 @@ int vfs_rename(struct inode *old_dir, st
+@@ -1960,9 +2034,9 @@ int vfs_rename(struct inode *old_dir, st
        DQUOT_INIT(new_dir);
  
        if (is_dir)
        if (!error) {
                if (old_dir == new_dir)
                        inode_dir_notify(old_dir, DN_RENAME);
-@@ -2005,7 +2082,7 @@ static inline int do_rename(const char *
+@@ -2005,7 +2079,7 @@ static inline int do_rename(const char *
  
        trap = lock_rename(new_dir, old_dir);
  
        error = PTR_ERR(old_dentry);
        if (IS_ERR(old_dentry))
                goto exit3;
-@@ -2025,7 +2102,7 @@ static inline int do_rename(const char *
+@@ -2025,7 +2099,7 @@ static inline int do_rename(const char *
        error = -EINVAL;
        if (old_dentry == trap)
                goto exit4;
        error = PTR_ERR(new_dentry);
        if (IS_ERR(new_dentry))
                goto exit4;
-@@ -2035,7 +2112,7 @@ static inline int do_rename(const char *
+@@ -2035,7 +2109,7 @@ static inline int do_rename(const char *
                goto exit5;
  
        error = vfs_rename(old_dir->d_inode, old_dentry,
  static void chroot_fs_refs(struct nameidata *old_nd, struct nameidata *new_nd)
  {
 --- linux-2.5.63-nointent/fs/open.c~lustre-2.5.63      Thu Mar 20 12:43:39 2003
-+++ linux-2.5.63-nointent-root/fs/open.c       Fri Mar 21 21:46:43 2003
++++ linux-2.5.63-nointent-root/fs/open.c       Mon Mar 24 16:25:47 2003
 @@ -97,7 +97,8 @@ static inline long do_sys_truncate(const
        struct nameidata nd;
        struct inode * inode;
  
        error = -EPERM;
        if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
-@@ -620,6 +644,8 @@ struct file *filp_open(const char * file
+@@ -619,7 +643,10 @@ asmlinkage long sys_fchown(unsigned int 
+ struct file *filp_open(const char * filename, int flags, int mode)
  {
        int namei_flags, error;
++      struct file * temp_filp;
        struct nameidata nd;
 +      struct lookup_intent it = { .it_op = IT_OPEN, .it_flags = flags };
 +      nd.it=it;       
  
        namei_flags = flags;
        if ((namei_flags+1) & O_ACCMODE)
+@@ -628,9 +655,11 @@ struct file *filp_open(const char * file
+               namei_flags |= 2;
+       error = open_namei(filename, namei_flags, mode, &nd);
+-      if (!error)
+-              return dentry_open(nd.dentry, nd.mnt, flags);
+-
++      if (!error) {
++              temp_filp = dentry_open(nd.dentry, nd.mnt, flags);
++              intent_release(nd.dentry,&nd.it);
++              return temp_filp;
++      }       
+       return ERR_PTR(error);
+ }
+@@ -675,7 +704,7 @@ struct file *dentry_open(struct dentry *
+                               goto cleanup_all;
+               }
+       }
+-
++        
+       return f;
+ cleanup_all:
 --- linux-2.5.63-nointent/fs/stat.c~lustre-2.5.63      Fri Mar 21 21:15:40 2003
 +++ linux-2.5.63-nointent-root/fs/stat.c       Fri Mar 21 21:16:53 2003
 @@ -65,6 +65,7 @@ int vfs_stat(char *name, struct kstat *s