Whamcloud - gitweb
update 2.4.18 patches for bug 1705
authorwangdi <wangdi>
Mon, 11 Aug 2003 05:53:22 +0000 (05:53 +0000)
committerwangdi <wangdi>
Mon, 11 Aug 2003 05:53:22 +0000 (05:53 +0000)
lustre/kernel_patches/patches/vfs_intent-2.4.18-18-chaos65.patch

index 03427ce..4895067 100644 (file)
  kernel/ksyms.c         |    1 
  12 files changed, 564 insertions(+), 99 deletions(-)
 
-Index: linux-2.4.18-p4smp/fs/exec.c
+Index: linux-2.4.18-chaos52/fs/exec.c
 ===================================================================
---- linux-2.4.18-p4smp.orig/fs/exec.c  Fri Jul 25 16:12:35 2003
-+++ linux-2.4.18-p4smp/fs/exec.c       Fri Jul 25 16:13:49 2003
-@@ -117,8 +117,9 @@
+--- linux-2.4.18-chaos52.orig/fs/exec.c        2003-08-11 10:10:12.000000000 +0800
++++ linux-2.4.18-chaos52/fs/exec.c     2003-08-11 10:17:04.000000000 +0800
+@@ -117,8 +117,10 @@
        struct file * file;
        struct nameidata nd;
        int error;
-+      struct lookup_intent it = { .it_op = IT_OPEN, .it_flags = O_RDONLY };
+-
 -      error = user_path_walk(library, &nd);
++      struct lookup_intent it = { .it_op = IT_OPEN,
++                                           .it_flags = FMODE_READ|FMODE_EXEC };
++                                           
 +      error = user_path_walk_it(library, &nd, &it);
        if (error)
                goto out;
  
-@@ -130,7 +131,8 @@
+@@ -130,7 +132,8 @@
        if (error)
                goto exit;
  
@@ -37,18 +39,19 @@ Index: linux-2.4.18-p4smp/fs/exec.c
        error = PTR_ERR(file);
        if (IS_ERR(file))
                goto out;
-@@ -359,8 +361,9 @@
+@@ -359,8 +362,9 @@
        struct inode *inode;
        struct file *file;
        int err = 0;
-+      struct lookup_intent it = { .it_op = IT_OPEN, .it_flags = O_RDONLY };
+-
 -      err = path_lookup(name, LOOKUP_FOLLOW|LOOKUP_POSITIVE, &nd);
++      struct lookup_intent it = { .it_op = IT_OPEN,
++                                           .it_flags = FMODE_READ|FMODE_EXEC };
 +      err = path_lookup_it(name, LOOKUP_FOLLOW|LOOKUP_POSITIVE, &nd, &it);
        file = ERR_PTR(err);
        if (!err) {
                inode = nd.dentry->d_inode;
-@@ -372,7 +375,8 @@
+@@ -372,7 +376,8 @@
                                err = -EACCES;
                        file = ERR_PTR(err);
                        if (!err) {
@@ -58,7 +61,7 @@ Index: linux-2.4.18-p4smp/fs/exec.c
                                if (!IS_ERR(file)) {
                                        err = deny_write_access(file);
                                        if (err) {
-@@ -384,6 +388,7 @@
+@@ -384,6 +389,7 @@
                                return file;
                        }
                }
@@ -66,7 +69,7 @@ Index: linux-2.4.18-p4smp/fs/exec.c
                path_release(&nd);
        }
        goto out;
-@@ -1104,7 +1109,7 @@
+@@ -1104,7 +1110,7 @@
                goto close_fail;
        if (!file->f_op->write)
                goto close_fail;
@@ -75,10 +78,10 @@ Index: linux-2.4.18-p4smp/fs/exec.c
                goto close_fail;
  
        retval = binfmt->core_dump(signr, regs, file);
-Index: linux-2.4.18-p4smp/fs/dcache.c
+Index: linux-2.4.18-chaos52/fs/dcache.c
 ===================================================================
---- linux-2.4.18-p4smp.orig/fs/dcache.c        Fri Jul 25 16:12:35 2003
-+++ linux-2.4.18-p4smp/fs/dcache.c     Fri Jul 25 16:13:49 2003
+--- linux-2.4.18-chaos52.orig/fs/dcache.c      2003-08-11 10:10:12.000000000 +0800
++++ linux-2.4.18-chaos52/fs/dcache.c   2003-08-11 10:11:27.000000000 +0800
 @@ -186,6 +186,13 @@
                spin_unlock(&dcache_lock);
                return 0;
@@ -116,10 +119,10 @@ Index: linux-2.4.18-p4smp/fs/dcache.c
  }
  
  #define do_switch(x,y) do { \
-Index: linux-2.4.18-p4smp/fs/namespace.c
+Index: linux-2.4.18-chaos52/fs/namespace.c
 ===================================================================
---- linux-2.4.18-p4smp.orig/fs/namespace.c     Fri Jul 25 16:12:35 2003
-+++ linux-2.4.18-p4smp/fs/namespace.c  Fri Jul 25 16:13:49 2003
+--- linux-2.4.18-chaos52.orig/fs/namespace.c   2003-08-11 10:10:12.000000000 +0800
++++ linux-2.4.18-chaos52/fs/namespace.c        2003-08-11 10:11:27.000000000 +0800
 @@ -99,6 +99,7 @@
  {
        old_nd->dentry = mnt->mnt_mountpoint;
@@ -233,10 +236,10 @@ Index: linux-2.4.18-p4smp/fs/namespace.c
        path_release(&new_nd);
  out0:
        unlock_kernel();
-Index: linux-2.4.18-p4smp/fs/namei.c
+Index: linux-2.4.18-chaos52/fs/namei.c
 ===================================================================
---- linux-2.4.18-p4smp.orig/fs/namei.c Fri Jul 25 16:12:35 2003
-+++ linux-2.4.18-p4smp/fs/namei.c      Fri Jul 25 16:30:22 2003
+--- linux-2.4.18-chaos52.orig/fs/namei.c       2003-08-11 10:10:12.000000000 +0800
++++ linux-2.4.18-chaos52/fs/namei.c    2003-08-11 10:11:27.000000000 +0800
 @@ -94,6 +94,13 @@
   * XEmacs seems to be relying on it...
   */
@@ -1024,10 +1027,10 @@ Index: linux-2.4.18-p4smp/fs/namei.c
        if (page) {
                kunmap(page);
                page_cache_release(page);
-Index: linux-2.4.18-p4smp/fs/open.c
+Index: linux-2.4.18-chaos52/fs/open.c
 ===================================================================
---- linux-2.4.18-p4smp.orig/fs/open.c  Fri Jul 25 16:12:35 2003
-+++ linux-2.4.18-p4smp/fs/open.c       Fri Jul 25 16:13:49 2003
+--- linux-2.4.18-chaos52.orig/fs/open.c        2003-08-11 10:10:12.000000000 +0800
++++ linux-2.4.18-chaos52/fs/open.c     2003-08-11 10:19:28.000000000 +0800
 @@ -19,6 +19,8 @@
  #include <asm/uaccess.h>
  
@@ -1241,7 +1244,7 @@ Index: linux-2.4.18-p4smp/fs/open.c
        if (error)
                goto out;
  
-@@ -454,6 +504,7 @@
+@@ -454,39 +504,56 @@
        set_fs_altroot();
        error = 0;
  dput_and_out:
@@ -1249,26 +1252,102 @@ Index: linux-2.4.18-p4smp/fs/open.c
        path_release(&nd);
  out:
        return error;
-@@ -508,6 +559,18 @@
-       if (IS_RDONLY(inode))
-               goto dput_and_out;
+ }
+-asmlinkage long sys_fchmod(unsigned int fd, mode_t mode)
++int chmod_common(struct dentry *dentry, mode_t mode)
+ {
+-      struct inode * inode;
+-      struct dentry * dentry;
+-      struct file * file;
+-      int err = -EBADF;
++      struct inode *inode = dentry->d_inode;
+       struct iattr newattrs;
++      int err = -EROFS;
+-      file = fget(fd);
+-      if (!file)
++      if (IS_RDONLY(inode))
+               goto out;
  
+-      dentry = file->f_dentry;
+-      inode = dentry->d_inode;
 +      if (inode->i_op->setattr_raw) {
-+              struct inode_operations *op = nd.dentry->d_inode->i_op;
-+
 +              newattrs.ia_mode = mode;
 +              newattrs.ia_valid = ATTR_MODE | ATTR_CTIME;
 +              newattrs.ia_valid |= ATTR_RAW;
-+              error = op->setattr_raw(inode, &newattrs);
++              err = inode->i_op->setattr_raw(inode, &newattrs);
 +              /* the file system wants to use normal vfs path now */
-+              if (error != -EOPNOTSUPP)
-+                      goto dput_and_out;
++              if (err != -EOPNOTSUPP)
++                      goto out;
 +      }
-+
-       error = -EPERM;
+-      err = -EROFS;
+-      if (IS_RDONLY(inode))
+-              goto out_putf;
+       err = -EPERM;
        if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
-               goto dput_and_out;
-@@ -538,6 +601,20 @@
+-              goto out_putf;
++              goto out;
++
+       if (mode == (mode_t) -1)
+               mode = inode->i_mode;
+       newattrs.ia_mode = (mode & S_IALLUGO) | (inode->i_mode & ~S_IALLUGO);
+       newattrs.ia_valid = ATTR_MODE | ATTR_CTIME;
+       err = notify_change(dentry, &newattrs);
+-out_putf:
++out:
++      return err;
++}
++
++asmlinkage long sys_fchmod(unsigned int fd, mode_t mode)
++{
++      struct file * file;
++      int err = -EBADF;
++
++      file = fget(fd);
++      if (!file)
++              goto out;
++
++      err = chmod_common(file->f_dentry, mode);
++
+       fput(file);
+ out:
+       return err;
+@@ -495,30 +562,14 @@
+ asmlinkage long sys_chmod(const char * filename, mode_t mode)
+ {
+       struct nameidata nd;
+-      struct inode * inode;
+       int error;
+-      struct iattr newattrs;
+       error = user_path_walk(filename, &nd);
+       if (error)
+               goto out;
+-      inode = nd.dentry->d_inode;
+-
+-      error = -EROFS;
+-      if (IS_RDONLY(inode))
+-              goto dput_and_out;
+-      error = -EPERM;
+-      if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
+-              goto dput_and_out;
+-
+-      if (mode == (mode_t) -1)
+-              mode = inode->i_mode;
+-      newattrs.ia_mode = (mode & S_IALLUGO) | (inode->i_mode & ~S_IALLUGO);
+-      newattrs.ia_valid = ATTR_MODE | ATTR_CTIME;
+-      error = notify_change(nd.dentry, &newattrs);
++      error = chmod_common(nd.dentry, mode);
+-dput_and_out:
+       path_release(&nd);
+ out:
+       return error;
+@@ -538,6 +589,20 @@
        error = -EROFS;
        if (IS_RDONLY(inode))
                goto out;
@@ -1289,7 +1368,7 @@ Index: linux-2.4.18-p4smp/fs/open.c
        error = -EPERM;
        if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
                goto out;
-@@ -628,7 +705,8 @@
+@@ -628,7 +693,8 @@
  /* for files over a certains size it doesn't pay to do readahead on open */
  #define READAHEAD_CUTOFF 48000
  
@@ -1299,7 +1378,7 @@ Index: linux-2.4.18-p4smp/fs/open.c
  {
        struct file * f;
        struct inode *inode;
-@@ -649,7 +727,7 @@
+@@ -649,7 +715,7 @@
                error = locks_verify_locked(inode);
                if (!error) {
                        DQUOT_INIT(inode);
@@ -1308,7 +1387,7 @@ Index: linux-2.4.18-p4smp/fs/open.c
                }
                if (error || !(f->f_mode & FMODE_WRITE))
                        put_write_access(inode);
-@@ -679,7 +757,9 @@
+@@ -679,7 +745,9 @@
        }
  
        if (f->f_op && f->f_op->open) {
@@ -1318,7 +1397,7 @@ Index: linux-2.4.18-p4smp/fs/open.c
                if (error)
                        goto cleanup_all;
        }
-@@ -693,6 +773,7 @@
+@@ -693,6 +761,7 @@
                do_readahead(f, 0, (48 * 1024) >> PAGE_SHIFT);
        
  
@@ -1326,7 +1405,7 @@ Index: linux-2.4.18-p4smp/fs/open.c
        return f;
  
  cleanup_all:
-@@ -707,11 +788,17 @@
+@@ -707,11 +776,17 @@
  cleanup_file:
        put_filp(f);
  cleanup_dentry:
@@ -1344,10 +1423,10 @@ Index: linux-2.4.18-p4smp/fs/open.c
  /*
   * Find an empty file descriptor entry, and mark it busy.
   */
-Index: linux-2.4.18-p4smp/fs/stat.c
+Index: linux-2.4.18-chaos52/fs/stat.c
 ===================================================================
---- linux-2.4.18-p4smp.orig/fs/stat.c  Fri Jul 25 16:12:35 2003
-+++ linux-2.4.18-p4smp/fs/stat.c       Fri Jul 25 16:13:49 2003
+--- linux-2.4.18-chaos52.orig/fs/stat.c        2003-08-11 10:10:12.000000000 +0800
++++ linux-2.4.18-chaos52/fs/stat.c     2003-08-11 10:11:27.000000000 +0800
 @@ -17,21 +17,24 @@
   * Revalidate the inode. This is required for proper NFS attribute caching.
   */
@@ -1425,10 +1504,10 @@ Index: linux-2.4.18-p4smp/fs/stat.c
                        UPDATE_ATIME(inode);
                        error = inode->i_op->readlink(nd.dentry, buf, bufsiz);
                }
-Index: linux-2.4.18-p4smp/include/linux/dcache.h
+Index: linux-2.4.18-chaos52/include/linux/dcache.h
 ===================================================================
---- linux-2.4.18-p4smp.orig/include/linux/dcache.h     Fri Jul 25 16:12:35 2003
-+++ linux-2.4.18-p4smp/include/linux/dcache.h  Fri Jul 25 16:13:49 2003
+--- linux-2.4.18-chaos52.orig/include/linux/dcache.h   2003-08-11 10:10:12.000000000 +0800
++++ linux-2.4.18-chaos52/include/linux/dcache.h        2003-08-11 10:11:28.000000000 +0800
 @@ -5,6 +5,51 @@
  
  #include <asm/atomic.h>
@@ -1512,11 +1591,19 @@ Index: linux-2.4.18-p4smp/include/linux/dcache.h
  
  extern spinlock_t dcache_lock;
  
-Index: linux-2.4.18-p4smp/include/linux/fs.h
+Index: linux-2.4.18-chaos52/include/linux/fs.h
 ===================================================================
---- linux-2.4.18-p4smp.orig/include/linux/fs.h Fri Jul 25 16:13:48 2003
-+++ linux-2.4.18-p4smp/include/linux/fs.h      Fri Jul 25 16:13:49 2003
-@@ -339,6 +339,9 @@
+--- linux-2.4.18-chaos52.orig/include/linux/fs.h       2003-08-11 10:11:24.000000000 +0800
++++ linux-2.4.18-chaos52/include/linux/fs.h    2003-08-11 10:41:55.000000000 +0800
+@@ -73,6 +73,7 @@
+ #define FMODE_READ 1
+ #define FMODE_WRITE 2
++#define FMODE_EXEC 4
+ #define READ 0
+ #define WRITE 1
+@@ -338,6 +339,9 @@
  #define ATTR_MTIME_SET        256
  #define ATTR_FORCE    512     /* Not a change, but a change it */
  #define ATTR_ATTR_FLAG        1024
@@ -1526,7 +1613,7 @@ Index: linux-2.4.18-p4smp/include/linux/fs.h
  
  /*
   * This is the Inode Attributes structure, used for notify_change().  It
-@@ -578,6 +581,7 @@
+@@ -576,6 +580,7 @@
  
        /* needed for tty driver, and maybe others */
        void                    *private_data;
@@ -1534,7 +1621,7 @@ Index: linux-2.4.18-p4smp/include/linux/fs.h
  
        /* preallocated helper kiobuf to speedup O_DIRECT */
        struct kiobuf           *f_iobuf;
-@@ -707,6 +711,7 @@
+@@ -705,6 +710,7 @@
        struct qstr last;
        unsigned int flags;
        int last_type;
@@ -1542,7 +1629,7 @@ Index: linux-2.4.18-p4smp/include/linux/fs.h
  };
  
  #define DQUOT_USR_ENABLED     0x01            /* User diskquotas enabled */
-@@ -840,7 +845,8 @@
+@@ -836,7 +842,8 @@
  extern int vfs_link(struct dentry *, struct inode *, struct dentry *);
  extern int vfs_rmdir(struct inode *, struct dentry *);
  extern int vfs_unlink(struct inode *, struct dentry *);
@@ -1552,7 +1639,7 @@ Index: linux-2.4.18-p4smp/include/linux/fs.h
  
  /*
   * File types
-@@ -900,21 +906,34 @@
+@@ -896,21 +903,34 @@
  
  struct inode_operations {
        int (*create) (struct inode *,struct dentry *,int);
@@ -1587,7 +1674,7 @@ Index: linux-2.4.18-p4smp/include/linux/fs.h
        int (*getattr) (struct dentry *, struct iattr *);
  };
  
-@@ -1119,10 +1138,12 @@
+@@ -1115,10 +1135,12 @@
  
  asmlinkage long sys_open(const char *, int, int);
  asmlinkage long sys_close(unsigned int);      /* yes, it's really unsigned */
@@ -1601,7 +1688,7 @@ Index: linux-2.4.18-p4smp/include/linux/fs.h
  extern int filp_close(struct file *, fl_owner_t id);
  extern char * getname(const char *);
  
-@@ -1388,9 +1409,12 @@
+@@ -1384,9 +1406,12 @@
  extern loff_t default_llseek(struct file *file, loff_t offset, int origin);
  
  extern int FASTCALL(__user_walk(const char *, unsigned, struct nameidata *));
@@ -1614,7 +1701,7 @@ Index: linux-2.4.18-p4smp/include/linux/fs.h
  extern int FASTCALL(link_path_walk(const char *, struct nameidata *));
  extern void path_release(struct nameidata *);
  extern int follow_down(struct vfsmount **, struct dentry **);
-@@ -1399,6 +1423,8 @@
+@@ -1395,6 +1420,8 @@
  extern struct dentry * lookup_hash(struct qstr *, struct dentry *);
  #define user_path_walk(name,nd)        __user_walk(name, LOOKUP_FOLLOW|LOOKUP_POSITIVE, nd)
  #define user_path_walk_link(name,nd) __user_walk(name, LOOKUP_POSITIVE, nd)
@@ -1623,7 +1710,7 @@ Index: linux-2.4.18-p4smp/include/linux/fs.h
  
  extern void inode_init_once(struct inode *);
  extern void iput(struct inode *);
-@@ -1499,6 +1525,8 @@
+@@ -1495,6 +1522,8 @@
  
  extern int vfs_readlink(struct dentry *, char *, int, const char *);
  extern int vfs_follow_link(struct nameidata *, const char *);
@@ -1632,10 +1719,10 @@ Index: linux-2.4.18-p4smp/include/linux/fs.h
  extern int page_readlink(struct dentry *, char *, int);
  extern int page_follow_link(struct dentry *, struct nameidata *);
  extern struct inode_operations page_symlink_inode_operations;
-Index: linux-2.4.18-p4smp/kernel/fork.c
+Index: linux-2.4.18-chaos52/kernel/fork.c
 ===================================================================
---- linux-2.4.18-p4smp.orig/kernel/fork.c      Fri Jul 25 16:12:35 2003
-+++ linux-2.4.18-p4smp/kernel/fork.c   Fri Jul 25 16:13:49 2003
+--- linux-2.4.18-chaos52.orig/kernel/fork.c    2003-08-11 10:10:13.000000000 +0800
++++ linux-2.4.18-chaos52/kernel/fork.c 2003-08-11 10:11:28.000000000 +0800
 @@ -399,10 +399,13 @@
                fs->umask = old->umask;
                read_lock(&old->lock);
@@ -1650,10 +1737,10 @@ Index: linux-2.4.18-p4smp/kernel/fork.c
                        fs->altrootmnt = mntget(old->altrootmnt);
                        fs->altroot = dget(old->altroot);
                } else {
-Index: linux-2.4.18-p4smp/kernel/exit.c
+Index: linux-2.4.18-chaos52/kernel/exit.c
 ===================================================================
---- linux-2.4.18-p4smp.orig/kernel/exit.c      Fri Jul 25 16:12:35 2003
-+++ linux-2.4.18-p4smp/kernel/exit.c   Fri Jul 25 16:13:49 2003
+--- linux-2.4.18-chaos52.orig/kernel/exit.c    2003-08-11 10:10:13.000000000 +0800
++++ linux-2.4.18-chaos52/kernel/exit.c 2003-08-11 10:11:28.000000000 +0800
 @@ -303,11 +303,14 @@
  {
        /* No need to hold fs->lock if we are killing it */
@@ -1669,10 +1756,10 @@ Index: linux-2.4.18-p4smp/kernel/exit.c
                        dput(fs->altroot);
                        mntput(fs->altrootmnt);
                }
-Index: linux-2.4.18-p4smp/kernel/ksyms.c
+Index: linux-2.4.18-chaos52/kernel/ksyms.c
 ===================================================================
---- linux-2.4.18-p4smp.orig/kernel/ksyms.c     Fri Jul 25 16:13:48 2003
-+++ linux-2.4.18-p4smp/kernel/ksyms.c  Fri Jul 25 16:13:49 2003
+--- linux-2.4.18-chaos52.orig/kernel/ksyms.c   2003-08-11 10:11:25.000000000 +0800
++++ linux-2.4.18-chaos52/kernel/ksyms.c        2003-08-11 10:11:28.000000000 +0800
 @@ -294,6 +294,7 @@
  EXPORT_SYMBOL(set_page_dirty);
  EXPORT_SYMBOL(vfs_readlink);