Merge branch 'task_killable' of git://git.kernel.org/pub/scm/linux/kernel/git/willy...
authorLinus Torvalds <torvalds@linux-foundation.org>
Fri, 1 Feb 2008 00:45:47 +0000 (11:45 +1100)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 1 Feb 2008 00:45:47 +0000 (11:45 +1100)
* 'task_killable' of git://git.kernel.org/pub/scm/linux/kernel/git/willy/misc: (22 commits)
  Remove commented-out code copied from NFS
  NFS: Switch from intr mount option to TASK_KILLABLE
  Add wait_for_completion_killable
  Add wait_event_killable
  Add schedule_timeout_killable
  Use mutex_lock_killable in vfs_readdir
  Add mutex_lock_killable
  Use lock_page_killable
  Add lock_page_killable
  Add fatal_signal_pending
  Add TASK_WAKEKILL
  exit: Use task_is_*
  signal: Use task_is_*
  sched: Use task_contributes_to_load, TASK_ALL and TASK_NORMAL
  ptrace: Use task_is_*
  power: Use task_is_*
  wait: Use TASK_NORMAL
  proc/base.c: Use task_is_*
  proc/array.c: Use TASK_REPORT
  perfmon: Use task_is_*
  ...

Fixed up conflicts in NFS/sunrpc manually..

23 files changed:
1  2 
fs/nfs/client.c
fs/nfs/direct.c
fs/nfs/inode.c
fs/nfs/nfs3proc.c
fs/nfs/nfs4proc.c
fs/nfs/pagelist.c
fs/nfs/super.c
fs/nfs/write.c
fs/proc/array.c
fs/proc/base.c
include/linux/nfs_fs.h
include/linux/sched.h
include/linux/sunrpc/clnt.h
include/linux/sunrpc/sched.h
kernel/ptrace.c
kernel/sched.c
kernel/signal.c
kernel/timer.c
mm/filemap.c
net/sunrpc/auth.c
net/sunrpc/clnt.c
net/sunrpc/rpcb_clnt.c
net/sunrpc/sched.c

diff --cc fs/nfs/client.c
Simple merge
diff --cc fs/nfs/direct.c
Simple merge
diff --cc fs/nfs/inode.c
Simple merge
Simple merge
Simple merge
@@@ -58,7 -58,7 +58,6 @@@ nfs_create_request(struct nfs_open_cont
                   struct page *page,
                   unsigned int offset, unsigned int count)
  {
--      struct nfs_server *server = NFS_SERVER(inode);
        struct nfs_page         *req;
  
        for (;;) {
diff --cc fs/nfs/super.c
Simple merge
diff --cc fs/nfs/write.c
Simple merge
diff --cc fs/proc/array.c
Simple merge
diff --cc fs/proc/base.c
@@@ -199,29 -199,9 +199,29 @@@ static int proc_root_link(struct inode 
        (task == current || \
        (task->parent == current && \
        (task->ptrace & PT_PTRACED) && \
-        (task->state == TASK_STOPPED || task->state == TASK_TRACED) && \
+        (task_is_stopped_or_traced(task)) && \
         security_ptrace(current,task) == 0))
  
 +struct mm_struct *mm_for_maps(struct task_struct *task)
 +{
 +      struct mm_struct *mm = get_task_mm(task);
 +      if (!mm)
 +              return NULL;
 +      down_read(&mm->mmap_sem);
 +      task_lock(task);
 +      if (task->mm != mm)
 +              goto out;
 +      if (task->mm != current->mm && __ptrace_may_attach(task) < 0)
 +              goto out;
 +      task_unlock(task);
 +      return mm;
 +out:
 +      task_unlock(task);
 +      up_read(&mm->mmap_sem);
 +      mmput(mm);
 +      return NULL;
 +}
 +
  static int proc_pid_cmdline(struct task_struct *task, char * buffer)
  {
        int res = 0;
Simple merge
Simple merge
@@@ -137,8 -134,8 +135,6 @@@ int                rpc_call_sync(struct rpc_clnt *cln
  struct rpc_task *rpc_call_null(struct rpc_clnt *clnt, struct rpc_cred *cred,
                               int flags);
  void          rpc_restart_call(struct rpc_task *);
--void          rpc_clnt_sigmask(struct rpc_clnt *clnt, sigset_t *oldset);
--void          rpc_clnt_sigunmask(struct rpc_clnt *clnt, sigset_t *oldset);
  void          rpc_setbufsize(struct rpc_clnt *, unsigned int, unsigned int);
  size_t                rpc_max_payload(struct rpc_clnt *);
  void          rpc_force_rebind(struct rpc_clnt *);
Simple merge
diff --cc kernel/ptrace.c
Simple merge
diff --cc kernel/sched.c
Simple merge
diff --cc kernel/signal.c
Simple merge
diff --cc kernel/timer.c
Simple merge
diff --cc mm/filemap.c
Simple merge
Simple merge
@@@ -515,76 -478,32 +513,29 @@@ static const struct rpc_call_ops rpc_de
        .rpc_call_done = rpc_default_callback,
  };
  
- /*
-  *    Export the signal mask handling for synchronous code that
-  *    sleeps on RPC calls
-  */
- #define RPC_INTR_SIGNALS (sigmask(SIGHUP) | sigmask(SIGINT) | sigmask(SIGQUIT) | sigmask(SIGTERM))
- static void rpc_save_sigmask(sigset_t *oldset, int intr)
- {
-       unsigned long   sigallow = sigmask(SIGKILL);
-       sigset_t sigmask;
-       /* Block all signals except those listed in sigallow */
-       if (intr)
-               sigallow |= RPC_INTR_SIGNALS;
-       siginitsetinv(&sigmask, sigallow);
-       sigprocmask(SIG_BLOCK, &sigmask, oldset);
- }
- static void rpc_task_sigmask(struct rpc_task *task, sigset_t *oldset)
- {
-       rpc_save_sigmask(oldset, !RPC_TASK_UNINTERRUPTIBLE(task));
- }
- static void rpc_restore_sigmask(sigset_t *oldset)
- {
-       sigprocmask(SIG_SETMASK, oldset, NULL);
- }
- void rpc_clnt_sigmask(struct rpc_clnt *clnt, sigset_t *oldset)
- {
-       rpc_save_sigmask(oldset, clnt->cl_intr);
- }
- EXPORT_SYMBOL_GPL(rpc_clnt_sigmask);
- void rpc_clnt_sigunmask(struct rpc_clnt *clnt, sigset_t *oldset)
- {
-       rpc_restore_sigmask(oldset);
- }
- EXPORT_SYMBOL_GPL(rpc_clnt_sigunmask);
 -static
 -struct rpc_task *rpc_do_run_task(struct rpc_clnt *clnt,
 -              struct rpc_message *msg,
 -              int flags,
 -              const struct rpc_call_ops *ops,
 -              void *data)
 +/**
 + * rpc_run_task - Allocate a new RPC task, then run rpc_execute against it
 + * @task_setup_data: pointer to task initialisation data
 + */
 +struct rpc_task *rpc_run_task(const struct rpc_task_setup *task_setup_data)
  {
        struct rpc_task *task, *ret;
-       sigset_t oldset;
  
 -      task = rpc_new_task(clnt, flags, ops, data);
 +      task = rpc_new_task(task_setup_data);
        if (task == NULL) {
 -              rpc_release_calldata(ops, data);
 -              return ERR_PTR(-ENOMEM);
 +              rpc_release_calldata(task_setup_data->callback_ops,
 +                              task_setup_data->callback_data);
 +              ret = ERR_PTR(-ENOMEM);
 +              goto out;
        }
  
 -      /* Mask signals on synchronous RPC calls and RPCSEC_GSS upcalls */
 -      if (msg != NULL) {
 -              rpc_call_setup(task, msg, 0);
 -              if (task->tk_status != 0) {
 -                      ret = ERR_PTR(task->tk_status);
 -                      rpc_put_task(task);
 -                      goto out;
 -              }
 +      if (task->tk_status != 0) {
 +              ret = ERR_PTR(task->tk_status);
 +              rpc_put_task(task);
 +              goto out;
        }
        atomic_inc(&task->tk_count);
-       /* Mask signals on synchronous RPC calls and RPCSEC_GSS upcalls */
-       if (!RPC_IS_ASYNC(task)) {
-               rpc_task_sigmask(task, &oldset);
-               rpc_execute(task);
-               rpc_restore_sigmask(&oldset);
-       } else
-               rpc_execute(task);
+       rpc_execute(task);
        ret = task;
  out:
        return ret;
Simple merge
@@@ -241,13 -241,13 +241,13 @@@ void rpc_init_priority_wait_queue(struc
  
  void rpc_init_wait_queue(struct rpc_wait_queue *queue, const char *qname)
  {
 -      __rpc_init_priority_wait_queue(queue, qname, 0);
 +      __rpc_init_priority_wait_queue(queue, qname, 1);
  }
 -EXPORT_SYMBOL(rpc_init_wait_queue);
 +EXPORT_SYMBOL_GPL(rpc_init_wait_queue);
  
- static int rpc_wait_bit_interruptible(void *word)
+ static int rpc_wait_bit_killable(void *word)
  {
-       if (signal_pending(current))
+       if (fatal_signal_pending(current))
                return -ERESTARTSYS;
        schedule();
        return 0;
@@@ -299,11 -299,11 +299,11 @@@ static void rpc_mark_complete_task(stru
  int __rpc_wait_for_completion_task(struct rpc_task *task, int (*action)(void *))
  {
        if (action == NULL)
-               action = rpc_wait_bit_interruptible;
+               action = rpc_wait_bit_killable;
        return wait_on_bit(&task->tk_runstate, RPC_TASK_ACTIVE,
-                       action, TASK_INTERRUPTIBLE);
+                       action, TASK_KILLABLE);
  }
 -EXPORT_SYMBOL(__rpc_wait_for_completion_task);
 +EXPORT_SYMBOL_GPL(__rpc_wait_for_completion_task);
  
  /*
   * Make an RPC task runnable.
@@@ -835,28 -832,13 +834,26 @@@ static void rpc_init_task(struct rpc_ta
        /* Initialize workqueue for async tasks */
        task->tk_workqueue = rpciod_workqueue;
  
 -      if (clnt) {
 -              kref_get(&clnt->cl_kref);
 -              if (clnt->cl_softrtry)
 +      task->tk_client = task_setup_data->rpc_client;
 +      if (task->tk_client != NULL) {
 +              kref_get(&task->tk_client->cl_kref);
 +              if (task->tk_client->cl_softrtry)
                        task->tk_flags |= RPC_TASK_SOFT;
-               if (!task->tk_client->cl_intr)
-                       task->tk_flags |= RPC_TASK_NOINTR;
        }
  
 -      BUG_ON(task->tk_ops == NULL);
 +      if (task->tk_ops->rpc_call_prepare != NULL)
 +              task->tk_action = rpc_prepare_task;
 +
 +      if (task_setup_data->rpc_message != NULL) {
 +              memcpy(&task->tk_msg, task_setup_data->rpc_message, sizeof(task->tk_msg));
 +              /* Bind the user cred */
 +              if (task->tk_msg.rpc_cred != NULL)
 +                      rpcauth_holdcred(task);
 +              else
 +                      rpcauth_bindcred(task);
 +              if (task->tk_action == NULL)
 +                      rpc_call_start(task);
 +      }
  
        /* starting timestamp */
        task->tk_start = jiffies;