Merge branch 'upstream-linus' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik...
[sfrench/cifs-2.6.git] / fs / aio.c
index d3a6ec2c9627e1e58a769c93398f2a3787bdfda8..ee20fc4240e0684bdb84485139ada96cb3925c09 100644 (file)
--- a/fs/aio.c
+++ b/fs/aio.c
@@ -586,7 +586,7 @@ static void use_mm(struct mm_struct *mm)
         * Note that on UML this *requires* PF_BORROWED_MM to be set, otherwise
         * it won't work. Update it accordingly if you change it here
         */
-       activate_mm(active_mm, mm);
+       switch_mm(active_mm, mm, tsk);
        task_unlock(tsk);
 
        mmdrop(active_mm);
@@ -599,9 +599,6 @@ static void use_mm(struct mm_struct *mm)
  *     by the calling kernel thread
  *     (Note: this routine is intended to be called only
  *     from a kernel thread context)
- *
- * Comments: Called with ctx->ctx_lock held. This nests
- * task_lock instead ctx_lock.
  */
 static void unuse_mm(struct mm_struct *mm)
 {
@@ -850,14 +847,16 @@ static void aio_kick_handler(struct work_struct *work)
 {
        struct kioctx *ctx = container_of(work, struct kioctx, wq.work);
        mm_segment_t oldfs = get_fs();
+       struct mm_struct *mm;
        int requeue;
 
        set_fs(USER_DS);
        use_mm(ctx->mm);
        spin_lock_irq(&ctx->ctx_lock);
        requeue =__aio_run_iocbs(ctx);
-       unuse_mm(ctx->mm);
+       mm = ctx->mm;
        spin_unlock_irq(&ctx->ctx_lock);
+       unuse_mm(mm);
        set_fs(oldfs);
        /*
         * we're in a worker thread already, don't use queue_delayed_work,