aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorZach Brown <zach.brown@oracle.com>2005-10-17 19:43:33 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2005-10-17 20:03:57 -0400
commit4faa5285283fad081443e3612ca426a311bb6c7e (patch)
treef5178184a94fb8343afee94a5b7cd47c05a2bc49 /fs
parente7507ed91e093b9e4e218e41ebfdce05458258fc (diff)
[PATCH] aio: revert lock_kiocb()
lock_kiocb() was introduced to serialize retrying and cancellation. In the process of doing so it tried to sleep waiting for KIF_LOCKED while holding the ctx_lock spinlock. Recent fixes have ensured that multiple concurrent retries won't be attempted for a given iocb. Cancel has other problems and has no significant in-tree users that have been complaining about it. So for the immediate future we'll revert sleeping with the lock held and will address proper cancellation and retry serialization in the future. Signed-off-by: Zach Brown <zach.brown@oracle.com> Acked-by: Benjamin LaHaise <bcrl@kvack.org> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/aio.c26
1 files changed, 1 insertions, 25 deletions
diff --git a/fs/aio.c b/fs/aio.c
index d6b1551342b7..9fe7216457d8 100644
--- a/fs/aio.c
+++ b/fs/aio.c
@@ -398,7 +398,7 @@ static struct kiocb fastcall *__aio_get_req(struct kioctx *ctx)
398 if (unlikely(!req)) 398 if (unlikely(!req))
399 return NULL; 399 return NULL;
400 400
401 req->ki_flags = 1 << KIF_LOCKED; 401 req->ki_flags = 0;
402 req->ki_users = 2; 402 req->ki_users = 2;
403 req->ki_key = 0; 403 req->ki_key = 0;
404 req->ki_ctx = ctx; 404 req->ki_ctx = ctx;
@@ -547,25 +547,6 @@ struct kioctx *lookup_ioctx(unsigned long ctx_id)
547 return ioctx; 547 return ioctx;
548} 548}
549 549
550static int lock_kiocb_action(void *param)
551{
552 schedule();
553 return 0;
554}
555
556static inline void lock_kiocb(struct kiocb *iocb)
557{
558 wait_on_bit_lock(&iocb->ki_flags, KIF_LOCKED, lock_kiocb_action,
559 TASK_UNINTERRUPTIBLE);
560}
561
562static inline void unlock_kiocb(struct kiocb *iocb)
563{
564 kiocbClearLocked(iocb);
565 smp_mb__after_clear_bit();
566 wake_up_bit(&iocb->ki_flags, KIF_LOCKED);
567}
568
569/* 550/*
570 * use_mm 551 * use_mm
571 * Makes the calling kernel thread take on the specified 552 * Makes the calling kernel thread take on the specified
@@ -796,9 +777,7 @@ static int __aio_run_iocbs(struct kioctx *ctx)
796 * Hold an extra reference while retrying i/o. 777 * Hold an extra reference while retrying i/o.
797 */ 778 */
798 iocb->ki_users++; /* grab extra reference */ 779 iocb->ki_users++; /* grab extra reference */
799 lock_kiocb(iocb);
800 aio_run_iocb(iocb); 780 aio_run_iocb(iocb);
801 unlock_kiocb(iocb);
802 if (__aio_put_req(ctx, iocb)) /* drop extra ref */ 781 if (__aio_put_req(ctx, iocb)) /* drop extra ref */
803 put_ioctx(ctx); 782 put_ioctx(ctx);
804 } 783 }
@@ -1542,7 +1521,6 @@ int fastcall io_submit_one(struct kioctx *ctx, struct iocb __user *user_iocb,
1542 1521
1543 spin_lock_irq(&ctx->ctx_lock); 1522 spin_lock_irq(&ctx->ctx_lock);
1544 aio_run_iocb(req); 1523 aio_run_iocb(req);
1545 unlock_kiocb(req);
1546 if (!list_empty(&ctx->run_list)) { 1524 if (!list_empty(&ctx->run_list)) {
1547 /* drain the run list */ 1525 /* drain the run list */
1548 while (__aio_run_iocbs(ctx)) 1526 while (__aio_run_iocbs(ctx))
@@ -1674,7 +1652,6 @@ asmlinkage long sys_io_cancel(aio_context_t ctx_id, struct iocb __user *iocb,
1674 if (NULL != cancel) { 1652 if (NULL != cancel) {
1675 struct io_event tmp; 1653 struct io_event tmp;
1676 pr_debug("calling cancel\n"); 1654 pr_debug("calling cancel\n");
1677 lock_kiocb(kiocb);
1678 memset(&tmp, 0, sizeof(tmp)); 1655 memset(&tmp, 0, sizeof(tmp));
1679 tmp.obj = (u64)(unsigned long)kiocb->ki_obj.user; 1656 tmp.obj = (u64)(unsigned long)kiocb->ki_obj.user;
1680 tmp.data = kiocb->ki_user_data; 1657 tmp.data = kiocb->ki_user_data;
@@ -1686,7 +1663,6 @@ asmlinkage long sys_io_cancel(aio_context_t ctx_id, struct iocb __user *iocb,
1686 if (copy_to_user(result, &tmp, sizeof(tmp))) 1663 if (copy_to_user(result, &tmp, sizeof(tmp)))
1687 ret = -EFAULT; 1664 ret = -EFAULT;
1688 } 1665 }
1689 unlock_kiocb(kiocb);
1690 } else 1666 } else
1691 ret = -EINVAL; 1667 ret = -EINVAL;
1692 1668