diff options
Diffstat (limited to 'fs/aio.c')
-rw-r--r-- | fs/aio.c | 26 |
1 files changed, 1 insertions, 25 deletions
@@ -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 | ||
550 | static int lock_kiocb_action(void *param) | ||
551 | { | ||
552 | schedule(); | ||
553 | return 0; | ||
554 | } | ||
555 | |||
556 | static 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 | |||
562 | static 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 | ||