Commit 81880059 authored by John Myers's avatar John Myers Committed by Anton Blanchard

[PATCH] aio updates

Please apply.

     fix uninitialized variable causing incorrect timeout
     make sys_io_cancel(), not cancel method, initialize most of returned result
     minor aio_cancel_all() optimization
parent 13ca00e1
...@@ -281,12 +281,12 @@ static void aio_cancel_all(struct kioctx *ctx) ...@@ -281,12 +281,12 @@ static void aio_cancel_all(struct kioctx *ctx)
struct kiocb *iocb = list_kiocb(pos); struct kiocb *iocb = list_kiocb(pos);
list_del_init(&iocb->ki_list); list_del_init(&iocb->ki_list);
cancel = iocb->ki_cancel; cancel = iocb->ki_cancel;
if (cancel) if (cancel) {
iocb->ki_users++; iocb->ki_users++;
spin_unlock_irq(&ctx->ctx_lock); spin_unlock_irq(&ctx->ctx_lock);
if (cancel)
cancel(iocb, &res); cancel(iocb, &res);
spin_lock_irq(&ctx->ctx_lock); spin_lock_irq(&ctx->ctx_lock);
}
} }
spin_unlock_irq(&ctx->ctx_lock); spin_unlock_irq(&ctx->ctx_lock);
} }
...@@ -843,13 +843,13 @@ static int read_events(struct kioctx *ctx, ...@@ -843,13 +843,13 @@ static int read_events(struct kioctx *ctx,
/* End fast path */ /* End fast path */
init_timeout(&to);
if (timeout) { if (timeout) {
struct timespec ts; struct timespec ts;
ret = -EFAULT; ret = -EFAULT;
if (unlikely(copy_from_user(&ts, timeout, sizeof(ts)))) if (unlikely(copy_from_user(&ts, timeout, sizeof(ts))))
goto out; goto out;
init_timeout(&to);
set_timeout(start_jiffies, &to, &ts); set_timeout(start_jiffies, &to, &ts);
} }
...@@ -1195,6 +1195,9 @@ asmlinkage long sys_io_cancel(aio_context_t ctx_id, struct iocb *iocb, ...@@ -1195,6 +1195,9 @@ asmlinkage long sys_io_cancel(aio_context_t ctx_id, struct iocb *iocb,
if (NULL != cancel) { if (NULL != cancel) {
struct io_event tmp; struct io_event tmp;
printk("calling cancel\n"); printk("calling cancel\n");
memset(&tmp, 0, sizeof(tmp));
tmp.obj = (u64)(unsigned long)kiocb->ki_user_obj;
tmp.data = kiocb->ki_user_data;
ret = cancel(kiocb, &tmp); ret = cancel(kiocb, &tmp);
if (!ret) { if (!ret) {
/* Cancellation succeeded -- copy the result /* Cancellation succeeded -- copy the result
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment