Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux...
authorLinus Torvalds <torvalds@linux-foundation.org>
Fri, 5 Mar 2010 21:20:53 +0000 (13:20 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 5 Mar 2010 21:20:53 +0000 (13:20 -0800)
* 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs-2.6: (33 commits)
  quota: stop using QUOTA_OK / NO_QUOTA
  dquot: cleanup dquot initialize routine
  dquot: move dquot initialization responsibility into the filesystem
  dquot: cleanup dquot drop routine
  dquot: move dquot drop responsibility into the filesystem
  dquot: cleanup dquot transfer routine
  dquot: move dquot transfer responsibility into the filesystem
  dquot: cleanup inode allocation / freeing routines
  dquot: cleanup space allocation / freeing routines
  ext3: add writepage sanity checks
  ext3: Truncate allocated blocks if direct IO write fails to update i_size
  quota: Properly invalidate caches even for filesystems with blocksize < pagesize
  quota: generalize quota transfer interface
  quota: sb_quota state flags cleanup
  jbd: Delay discarding buffers in journal_unmap_buffer
  ext3: quota_write cross block boundary behaviour
  quota: drop permission checks from xfs_fs_set_xstate/xfs_fs_set_xquota
  quota: split out compat_sys_quotactl support from quota.c
  quota: split out netlink notification support from quota.c
  quota: remove invalid optimization from quota_sync_all
  ...

Fixed trivial conflicts in fs/namei.c and fs/ufs/inode.c

28 files changed:
1  2 
fs/ext2/inode.c
fs/ext3/inode.c
fs/ext4/file.c
fs/ext4/ialloc.c
fs/ext4/inode.c
fs/ext4/mballoc.c
fs/ext4/namei.c
fs/ext4/super.c
fs/ext4/xattr.c
fs/gfs2/super.c
fs/gfs2/sys.c
fs/jfs/inode.c
fs/jfs/jfs_inode.h
fs/namei.c
fs/nfsd/vfs.c
fs/ocfs2/alloc.c
fs/ocfs2/aops.c
fs/ocfs2/dir.c
fs/ocfs2/file.c
fs/ocfs2/refcounttree.c
fs/open.c
fs/reiserfs/inode.c
fs/udf/balloc.c
fs/udf/inode.c
fs/udf/namei.c
fs/ufs/inode.c
include/linux/ext3_fs.h
include/linux/jbd2.h

diff --cc fs/ext2/inode.c
Simple merge
diff --cc fs/ext3/inode.c
Simple merge
diff --cc fs/ext4/file.c
Simple merge
Simple merge
diff --cc fs/ext4/inode.c
Simple merge
Simple merge
diff --cc fs/ext4/namei.c
Simple merge
diff --cc fs/ext4/super.c
Simple merge
diff --cc fs/ext4/xattr.c
Simple merge
diff --cc fs/gfs2/super.c
Simple merge
diff --cc fs/gfs2/sys.c
Simple merge
diff --cc fs/jfs/inode.c
Simple merge
Simple merge
diff --cc fs/namei.c
@@@ -1558,88 -1601,68 +1556,85 @@@ static int open_will_truncate(int flag
        return (flag & O_TRUNC);
  }
  
 -/*
 - * Note that the low bits of the passed in "open_flag"
 - * are not the same as in the local variable "flag". See
 - * open_to_namei_flags() for more details.
 - */
 -struct file *do_filp_open(int dfd, const char *pathname,
 -              int open_flag, int mode, int acc_mode)
 +static struct file *finish_open(struct nameidata *nd,
 +                              int open_flag, int acc_mode)
  {
        struct file *filp;
 -      struct nameidata nd;
 -      int error;
 -      struct path path;
 -      struct dentry *dir;
 -      int count = 0;
        int will_truncate;
 -      int flag = open_to_namei_flags(open_flag);
 -      int force_reval = 0;
 +      int error;
  
-               if (acc_mode & MAY_WRITE)
-                       vfs_dq_init(nd->path.dentry->d_inode);
 +      will_truncate = open_will_truncate(open_flag, nd->path.dentry->d_inode);
 +      if (will_truncate) {
 +              error = mnt_want_write(nd->path.mnt);
 +              if (error)
 +                      goto exit;
 +      }
 +      error = may_open(&nd->path, acc_mode, open_flag);
 +      if (error) {
 +              if (will_truncate)
 +                      mnt_drop_write(nd->path.mnt);
 +              goto exit;
 +      }
 +      filp = nameidata_to_filp(nd);
 +      if (!IS_ERR(filp)) {
 +              error = ima_file_check(filp, acc_mode);
 +              if (error) {
 +                      fput(filp);
 +                      filp = ERR_PTR(error);
 +              }
 +      }
 +      if (!IS_ERR(filp)) {
 +              if (will_truncate) {
 +                      error = handle_truncate(&nd->path);
 +                      if (error) {
 +                              fput(filp);
 +                              filp = ERR_PTR(error);
 +                      }
 +              }
 +      }
        /*
 -       * O_SYNC is implemented as __O_SYNC|O_DSYNC.  As many places only
 -       * check for O_DSYNC if the need any syncing at all we enforce it's
 -       * always set instead of having to deal with possibly weird behaviour
 -       * for malicious applications setting only __O_SYNC.
 +       * It is now safe to drop the mnt write
 +       * because the filp has had a write taken
 +       * on its behalf.
         */
 -      if (open_flag & __O_SYNC)
 -              open_flag |= O_DSYNC;
 -
 -      if (!acc_mode)
 -              acc_mode = MAY_OPEN | ACC_MODE(open_flag);
 +      if (will_truncate)
 +              mnt_drop_write(nd->path.mnt);
 +      return filp;
  
 -      /* O_TRUNC implies we need access checks for write permissions */
 -      if (flag & O_TRUNC)
 -              acc_mode |= MAY_WRITE;
 +exit:
 +      if (!IS_ERR(nd->intent.open.file))
 +              release_open_intent(nd);
 +      path_put(&nd->path);
 +      return ERR_PTR(error);
 +}
  
 -      /* Allow the LSM permission hook to distinguish append 
 -         access from general write access. */
 -      if (flag & O_APPEND)
 -              acc_mode |= MAY_APPEND;
 +static struct file *do_last(struct nameidata *nd, struct path *path,
 +                          int open_flag, int acc_mode,
 +                          int mode, const char *pathname,
 +                          int *want_dir)
 +{
 +      struct dentry *dir = nd->path.dentry;
 +      struct file *filp;
 +      int error = -EISDIR;
  
 -      /*
 -       * The simplest case - just a plain lookup.
 -       */
 -      if (!(flag & O_CREAT)) {
 -              filp = get_empty_filp();
 -
 -              if (filp == NULL)
 -                      return ERR_PTR(-ENFILE);
 -              nd.intent.open.file = filp;
 -              filp->f_flags = open_flag;
 -              nd.intent.open.flags = flag;
 -              nd.intent.open.create_mode = 0;
 -              error = do_path_lookup(dfd, pathname,
 -                                      lookup_flags(flag)|LOOKUP_OPEN, &nd);
 -              if (IS_ERR(nd.intent.open.file)) {
 -                      if (error == 0) {
 -                              error = PTR_ERR(nd.intent.open.file);
 -                              path_put(&nd.path);
 +      switch (nd->last_type) {
 +      case LAST_DOTDOT:
 +              follow_dotdot(nd);
 +              dir = nd->path.dentry;
 +              if (nd->path.mnt->mnt_sb->s_type->fs_flags & FS_REVAL_DOT) {
 +                      if (!dir->d_op->d_revalidate(dir, nd)) {
 +                              error = -ESTALE;
 +                              goto exit;
                        }
 -              } else if (error)
 -                      release_open_intent(&nd);
 -              if (error)
 -                      return ERR_PTR(error);
 +              }
 +              /* fallthrough */
 +      case LAST_DOT:
 +      case LAST_ROOT:
 +              if (open_flag & O_CREAT)
 +                      goto exit;
 +              /* fallthrough */
 +      case LAST_BIND:
 +              audit_inode(pathname, dir);
                goto ok;
        }
  
diff --cc fs/nfsd/vfs.c
Simple merge
Simple merge
diff --cc fs/ocfs2/aops.c
Simple merge
diff --cc fs/ocfs2/dir.c
Simple merge
diff --cc fs/ocfs2/file.c
Simple merge
Simple merge
diff --cc fs/open.c
Simple merge
Simple merge
diff --cc fs/udf/balloc.c
Simple merge
diff --cc fs/udf/inode.c
Simple merge
diff --cc fs/udf/namei.c
Simple merge
diff --cc fs/ufs/inode.c
@@@ -36,7 -36,7 +36,8 @@@
  #include <linux/mm.h>
  #include <linux/smp_lock.h>
  #include <linux/buffer_head.h>
 +#include <linux/writeback.h>
+ #include <linux/quotaops.h>
  
  #include "ufs_fs.h"
  #include "ufs.h"
Simple merge
Simple merge