#include <linux/time.h>
#include <linux/aio_abi.h>
#include <linux/module.h>
+#include <linux/syscalls.h>
#define DEBUG 0
static void aio_fput_routine(void *);
static DECLARE_WORK(fput_work, aio_fput_routine, NULL);
-static spinlock_t fput_lock = SPIN_LOCK_UNLOCKED;
+static DEFINE_SPINLOCK(fput_lock);
LIST_HEAD(fput_head);
static void aio_kick_handler(void *);
if (nr_pages < 0)
return -EINVAL;
- info->nr_pages = nr_pages;
-
nr_events = (PAGE_SIZE * nr_pages - sizeof(struct aio_ring)) / sizeof(struct io_event);
info->nr = 0;
struct task_struct *tsk = current;
task_lock(tsk);
+ tsk->flags |= PF_BORROWED_MM;
active_mm = tsk->active_mm;
atomic_inc(&mm->mm_count);
tsk->mm = mm;
struct task_struct *tsk = current;
task_lock(tsk);
+ tsk->flags &= ~PF_BORROWED_MM;
tsk->mm = NULL;
/* active_mm is still 'mm' */
enter_lazy_tlb(mm, tsk);
if (!ret)
return 0;
+ get_ioctx(ioctx); /* io_destroy() expects us to hold a ref */
io_destroy(ioctx);
}