]> git.karo-electronics.de Git - mv-sheeva.git/blobdiff - kernel/fork.c
Merge git://git.kernel.org/pub/scm/linux/kernel/git/bart/ide-2.6
[mv-sheeva.git] / kernel / fork.c
index 2a86c9dff7447f90640c398b3c2b1998edb799d6..05e0b6f4365bfc5fca5ef1cabd400c3894c013e3 100644 (file)
@@ -393,6 +393,7 @@ void fastcall __mmdrop(struct mm_struct *mm)
        destroy_context(mm);
        free_mm(mm);
 }
+EXPORT_SYMBOL_GPL(__mmdrop);
 
 /*
  * Decrement the use count and release all resources for an mm.
@@ -792,20 +793,25 @@ out:
        return error;
 }
 
-static int copy_io(struct task_struct *tsk)
+static int copy_io(unsigned long clone_flags, struct task_struct *tsk)
 {
 #ifdef CONFIG_BLOCK
        struct io_context *ioc = current->io_context;
 
        if (!ioc)
                return 0;
-
-       if (ioprio_valid(ioc->ioprio)) {
+       /*
+        * Share io context with parent, if CLONE_IO is set
+        */
+       if (clone_flags & CLONE_IO) {
+               tsk->io_context = ioc_task_link(ioc);
+               if (unlikely(!tsk->io_context))
+                       return -ENOMEM;
+       } else if (ioprio_valid(ioc->ioprio)) {
                tsk->io_context = alloc_io_context(GFP_KERNEL, -1);
                if (unlikely(!tsk->io_context))
                        return -ENOMEM;
 
-               tsk->io_context->task = tsk;
                tsk->io_context->ioprio = ioc->ioprio;
        }
 #endif
@@ -1177,7 +1183,7 @@ static struct task_struct *copy_process(unsigned long clone_flags,
                goto bad_fork_cleanup_mm;
        if ((retval = copy_namespaces(clone_flags, p)))
                goto bad_fork_cleanup_keys;
-       if ((retval = copy_io(p)))
+       if ((retval = copy_io(clone_flags, p)))
                goto bad_fork_cleanup_namespaces;
        retval = copy_thread(0, clone_flags, stack_start, stack_size, p, regs);
        if (retval)