Merge branch 'for-linus-2' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
authorLinus Torvalds <torvalds@linux-foundation.org>
Mon, 23 Jul 2012 19:27:27 +0000 (12:27 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Mon, 23 Jul 2012 19:27:27 +0000 (12:27 -0700)
Pull the big VFS changes from Al Viro:
 "This one is *big* and changes quite a few things around VFS.  What's in there:

   - the first of two really major architecture changes - death to open
     intents.

     The former is finally there; it was very long in making, but with
     Miklos getting through really hard and messy final push in
     fs/namei.c, we finally have it.  Unlike his variant, this one
     doesn't introduce struct opendata; what we have instead is
     ->atomic_open() taking preallocated struct file * and passing
     everything via its fields.

     Instead of returning struct file *, it returns -E...  on error, 0
     on success and 1 in "deal with it yourself" case (e.g.  symlink
     found on server, etc.).

     See comments before fs/namei.c:atomic_open().  That made a lot of
     goodies finally possible and quite a few are in that pile:
     ->lookup(), ->d_revalidate() and ->create() do not get struct
     nameidata * anymore; ->lookup() and ->d_revalidate() get lookup
     flags instead, ->create() gets "do we want it exclusive" flag.

     With the introduction of new helper (kern_path_locked()) we are rid
     of all struct nameidata instances outside of fs/namei.c; it's still
     visible in namei.h, but not for long.  Come the next cycle,
     declaration will move either to fs/internal.h or to fs/namei.c
     itself.  [me, miklos, hch]

   - The second major change: behaviour of final fput().  Now we have
     __fput() done without any locks held by caller *and* not from deep
     in call stack.

     That obviously lifts a lot of constraints on the locking in there.
     Moreover, it's legal now to call fput() from atomic contexts (which
     has immediately simplified life for aio.c).  We also don't need
     anti-recursion logics in __scm_destroy() anymore.

     There is a price, though - the damn thing has become partially
     asynchronous.  For fput() from normal process we are guaranteed
     that pending __fput() will be done before the caller returns to
     userland, exits or gets stopped for ptrace.

     For kernel threads and atomic contexts it's done via
     schedule_work(), so theoretically we might need a way to make sure
     it's finished; so far only one such place had been found, but there
     might be more.

     There's flush_delayed_fput() (do all pending __fput()) and there's
     __fput_sync() (fput() analog doing __fput() immediately).  I hope
     we won't need them often; see warnings in fs/file_table.c for
     details.  [me, based on task_work series from Oleg merged last
     cycle]

   - sync series from Jan

   - large part of "death to sync_supers()" work from Artem; the only
     bits missing here are exofs and ext4 ones.  As far as I understand,
     those are going via the exofs and ext4 trees resp.; once they are
     in, we can put ->write_super() to the rest, along with the thread
     calling it.

   - preparatory bits from unionmount series (from dhowells).

   - assorted cleanups and fixes all over the place, as usual.

  This is not the last pile for this cycle; there's at least jlayton's
  ESTALE work and fsfreeze series (the latter - in dire need of fixes,
  so I'm not sure it'll make the cut this cycle).  I'll probably throw
  symlink/hardlink restrictions stuff from Kees into the next pile, too.
  Plus there's a lot of misc patches I hadn't thrown into that one -
  it's large enough as it is..."

* 'for-linus-2' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (127 commits)
  ext4: switch EXT4_IOC_RESIZE_FS to mnt_want_write_file()
  btrfs: switch btrfs_ioctl_balance() to mnt_want_write_file()
  switch dentry_open() to struct path, make it grab references itself
  spufs: shift dget/mntget towards dentry_open()
  zoran: don't bother with struct file * in zoran_map
  ecryptfs: don't reinvent the wheels, please - use struct completion
  don't expose I_NEW inodes via dentry->d_inode
  tidy up namei.c a bit
  unobfuscate follow_up() a bit
  ext3: pass custom EOF to generic_file_llseek_size()
  ext4: use core vfs llseek code for dir seeks
  vfs: allow custom EOF in generic_file_llseek code
  vfs: Avoid unnecessary WB_SYNC_NONE writeback during sys_sync and reorder sync passes
  vfs: Remove unnecessary flushing of block devices
  vfs: Make sys_sync writeout also block device inodes
  vfs: Create function for iterating over block devices
  vfs: Reorder operations during sys_sync
  quota: Move quota syncing to ->sync_fs method
  quota: Split dquot_quota_sync() to writeback and cache flushing part
  vfs: Move noop_backing_dev_info check from sync into writeback
  ...

1  2 
fs/ext4/ioctl.c
include/linux/sched.h
kernel/fork.c
security/selinux/hooks.c

diff --combined fs/ext4/ioctl.c
@@@ -268,6 -268,7 +268,6 @@@ group_extend_out
                err = ext4_move_extents(filp, donor_filp, me.orig_start,
                                        me.donor_start, me.len, &me.moved_len);
                mnt_drop_write_file(filp);
 -              mnt_drop_write(filp->f_path.mnt);
  
                if (copy_to_user((struct move_extent __user *)arg,
                                 &me, sizeof(me)))
@@@ -389,7 -390,7 +389,7 @@@ group_add_out
                if (err)
                        return err;
  
-               err = mnt_want_write(filp->f_path.mnt);
+               err = mnt_want_write_file(filp);
                if (err)
                        goto resizefs_out;
  
                }
                if (err == 0)
                        err = err2;
-               mnt_drop_write(filp->f_path.mnt);
+               mnt_drop_write_file(filp);
  resizefs_out:
                ext4_resize_end(sb);
                return err;
diff --combined include/linux/sched.h
@@@ -1405,7 -1405,7 +1405,7 @@@ struct task_struct 
        int (*notifier)(void *priv);
        void *notifier_data;
        sigset_t *notifier_mask;
-       struct hlist_head task_works;
+       struct callback_head *task_works;
  
        struct audit_context *audit_context;
  #ifdef CONFIG_AUDITSYSCALL
        unsigned long timer_slack_ns;
        unsigned long default_timer_slack_ns;
  
-       struct list_head        *scm_work_list;
  #ifdef CONFIG_FUNCTION_GRAPH_TRACER
        /* Index of current stored address in ret_stack */
        int curr_ret_stack;
  #endif
  #ifdef CONFIG_UPROBES
        struct uprobe_task *utask;
 -      int uprobe_srcu_id;
  #endif
  };
  
@@@ -1870,12 -1870,22 +1869,12 @@@ static inline void rcu_copy_process(str
        INIT_LIST_HEAD(&p->rcu_node_entry);
  }
  
 -static inline void rcu_switch_from(struct task_struct *prev)
 -{
 -      if (prev->rcu_read_lock_nesting != 0)
 -              rcu_preempt_note_context_switch();
 -}
 -
  #else
  
  static inline void rcu_copy_process(struct task_struct *p)
  {
  }
  
 -static inline void rcu_switch_from(struct task_struct *prev)
 -{
 -}
 -
  #endif
  
  #ifdef CONFIG_SMP
@@@ -1898,14 -1908,6 +1897,14 @@@ static inline int set_cpus_allowed_ptr(
  }
  #endif
  
 +#ifdef CONFIG_NO_HZ
 +void calc_load_enter_idle(void);
 +void calc_load_exit_idle(void);
 +#else
 +static inline void calc_load_enter_idle(void) { }
 +static inline void calc_load_exit_idle(void) { }
 +#endif /* CONFIG_NO_HZ */
 +
  #ifndef CONFIG_CPUMASK_OFFSTACK
  static inline int set_cpus_allowed(struct task_struct *p, cpumask_t new_mask)
  {
diff --combined kernel/fork.c
@@@ -304,17 -304,12 +304,17 @@@ static struct task_struct *dup_task_str
        }
  
        err = arch_dup_task_struct(tsk, orig);
 -      if (err)
 -              goto out;
  
 +      /*
 +       * We defer looking at err, because we will need this setup
 +       * for the clean up path to work correctly.
 +       */
        tsk->stack = ti;
 -
        setup_thread_stack(tsk, orig);
 +
 +      if (err)
 +              goto out;
 +
        clear_user_return_notifier(tsk);
        clear_tsk_need_resched(tsk);
        stackend = end_of_stack(tsk);
@@@ -1420,7 -1415,7 +1420,7 @@@ static struct task_struct *copy_process
         */
        p->group_leader = p;
        INIT_LIST_HEAD(&p->thread_group);
-       INIT_HLIST_HEAD(&p->task_works);
+       p->task_works = NULL;
  
        /* Now that the task is set up, run cgroup callbacks if
         * necessary. We need to run them before the task is visible
diff --combined security/selinux/hooks.c
@@@ -2157,8 -2157,7 +2157,7 @@@ static inline void flush_unauthorized_f
                                                get_file(devnull);
                                        } else {
                                                devnull = dentry_open(
-                                                       dget(selinux_null),
-                                                       mntget(selinuxfs_mount),
+                                                       &selinux_null,
                                                        O_RDWR, cred);
                                                if (IS_ERR(devnull)) {
                                                        devnull = NULL;
@@@ -2717,7 -2716,7 +2716,7 @@@ static int selinux_inode_setattr(struc
                        ATTR_ATIME_SET | ATTR_MTIME_SET | ATTR_TIMES_SET))
                return dentry_has_perm(cred, dentry, FILE__SETATTR);
  
 -      if (ia_valid & ATTR_SIZE)
 +      if (selinux_policycap_openperm && (ia_valid & ATTR_SIZE))
                av |= FILE__OPEN;
  
        return dentry_has_perm(cred, dentry, av);