aboutsummaryrefslogtreecommitdiffstats
path: root/fs/aio.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2015-02-11 13:59:44 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2015-03-13 12:10:22 -0400
commit599bd19bdc4c6b20fd91d50f2f79dececbaf80c1 (patch)
tree782dec7d04dd789c841e3798ee4c920c9493fe2c /fs/aio.c
parent9d5722b7777e64de2d932f46cfee7765fdcc60d6 (diff)
fs: don't allow to complete sync iocbs through aio_complete
The AIO interface is fairly complex because it tries to allow filesystems to always work async and then wakeup a synchronous caller through aio_complete. It turns out that basically no one was doing this to avoid the complexity and context switches, and we've already fixed up the remaining users and can now get rid of this case. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/aio.c')
-rw-r--r--fs/aio.c24
1 files changed, 1 insertions, 23 deletions
diff --git a/fs/aio.c b/fs/aio.c
index 667054c7c067..8ca8df1c3550 100644
--- a/fs/aio.c
+++ b/fs/aio.c
@@ -778,22 +778,6 @@ static int kill_ioctx(struct mm_struct *mm, struct kioctx *ctx,
778 return 0; 778 return 0;
779} 779}
780 780
781/* wait_on_sync_kiocb:
782 * Waits on the given sync kiocb to complete.
783 */
784ssize_t wait_on_sync_kiocb(struct kiocb *req)
785{
786 while (!req->ki_ctx) {
787 set_current_state(TASK_UNINTERRUPTIBLE);
788 if (req->ki_ctx)
789 break;
790 io_schedule();
791 }
792 __set_current_state(TASK_RUNNING);
793 return req->ki_user_data;
794}
795EXPORT_SYMBOL(wait_on_sync_kiocb);
796
797/* 781/*
798 * exit_aio: called when the last user of mm goes away. At this point, there is 782 * exit_aio: called when the last user of mm goes away. At this point, there is
799 * no way for any new requests to be submited or any of the io_* syscalls to be 783 * no way for any new requests to be submited or any of the io_* syscalls to be
@@ -1025,13 +1009,7 @@ void aio_complete(struct kiocb *iocb, long res, long res2)
1025 * ref, no other paths have a way to get another ref 1009 * ref, no other paths have a way to get another ref
1026 * - the sync task helpfully left a reference to itself in the iocb 1010 * - the sync task helpfully left a reference to itself in the iocb
1027 */ 1011 */
1028 if (is_sync_kiocb(iocb)) { 1012 BUG_ON(is_sync_kiocb(iocb));
1029 iocb->ki_user_data = res;
1030 smp_wmb();
1031 iocb->ki_ctx = ERR_PTR(-EXDEV);
1032 wake_up_process(iocb->ki_obj.tsk);
1033 return;
1034 }
1035 1013
1036 if (iocb->ki_list.next) { 1014 if (iocb->ki_list.next) {
1037 unsigned long flags; 1015 unsigned long flags;