[PATCH] Add ENOSYS into sys_io_cancel

From: Wendy Cheng
Date: Mon Jul 11 2005 - 14:18:24 EST


Previously sent via private mail that doesn't seem to go thru - resend via office mailer.

Note that other than few exceptions, most of the current filesystem and/or drivers do not have aio cancel specifically defined (kiob->ki_cancel field is mostly NULL). However, sys_io_cancel system call universally sets return code to -EGAIN. This gives applications a wrong impression that this call is implemented but just never works. We have customer inquires about this issue.

Upload a trivial patch to address this confusion.

-- Wendy


--- linux-2.6.12/fs/aio.c 2005-06-17 15:48:29.000000000 -0400
+++ linux/fs/aio.c 2005-07-10 12:48:14.000000000 -0400
@@ -1641,8 +1641,9 @@ asmlinkage long sys_io_cancel(aio_contex
cancel = kiocb->ki_cancel;
kiocb->ki_users ++;
kiocbSetCancelled(kiocb);
- } else
+ } else
cancel = NULL;
+
spin_unlock_irq(&ctx->ctx_lock);

if (NULL != cancel) {
@@ -1659,8 +1660,10 @@ asmlinkage long sys_io_cancel(aio_contex
if (copy_to_user(result, &tmp, sizeof(tmp)))
ret = -EFAULT;
}
- } else
+ } else {
+ ret = -ENOSYS;
printk(KERN_DEBUG "iocb has no cancel operation\n");
+ }

put_ioctx(ctx);