X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=fs%2Faio.c;h=9980002ac3f370d4700839c1c7db9b22931c3139;hb=6a77f38946aaee1cd85eeec6cf4229b204c15071;hp=0cd2c6a10e734c40e6fef234a7938ddea909e90c;hpb=87fc8d1bb10cd459024a742c6a10961fefcef18f;p=linux-2.6.git diff --git a/fs/aio.c b/fs/aio.c index 0cd2c6a10..9980002ac 100644 --- a/fs/aio.c +++ b/fs/aio.c @@ -14,6 +14,7 @@ #include #include #include +#include #define DEBUG 0 @@ -56,7 +57,7 @@ static struct workqueue_struct *aio_wq; 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 *); @@ -117,8 +118,6 @@ static int aio_setup_ring(struct kioctx *ctx) 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; @@ -571,6 +570,7 @@ static void use_mm(struct mm_struct *mm) 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; @@ -597,6 +597,7 @@ void unuse_mm(struct mm_struct *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); @@ -1284,6 +1285,7 @@ asmlinkage long sys_io_setup(unsigned nr_events, aio_context_t __user *ctxp) if (!ret) return 0; + get_ioctx(ioctx); /* io_destroy() expects us to hold a ref */ io_destroy(ioctx); }