From 5195fd5967bd1a07660cb40b86744201988c9ca0 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Tue, 13 Jan 2009 13:59:21 +0100 Subject: [PATCH] aio: buffered oops fix Signed-off-by: Jens Axboe --- fs/aio.c | 13 ++++++++----- include/linux/wait.h | 5 ++++- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/fs/aio.c b/fs/aio.c index 961f62a32109..39ee8d1cbc0a 100644 --- a/fs/aio.c +++ b/fs/aio.c @@ -700,7 +700,10 @@ static ssize_t aio_run_iocb(struct kiocb *iocb) ret = retry(iocb); current->io_wait = NULL; - if (ret != -EIOCBRETRY && ret != -EIOCBQUEUED) { + if (ret == -EIOCBRETRY) { + if (list_empty(&iocb->ki_wq.wait.task_list)) + kiocbSetKicked(iocb); + } else if (ret != -EIOCBQUEUED) { BUG_ON(!list_empty(&iocb->ki_wq.wait.task_list)); aio_complete(iocb, ret, 0); } @@ -724,10 +727,10 @@ out: __queue_kicked_iocb(iocb); /* - * __queue_kicked_iocb will always return 1 here, because - * iocb->ki_run_list is empty at this point so it should - * be safe to unconditionally queue the context into the - * work queue. + * __queue_kicked_iocb will always return 1 here, + * because iocb->ki_run_list is empty at this point so + * it should be safe to unconditionally queue the + * context into the work queue. */ aio_queue_work(ctx); } diff --git a/include/linux/wait.h b/include/linux/wait.h index 586198803c0d..c5e20bbf26c3 100644 --- a/include/linux/wait.h +++ b/include/linux/wait.h @@ -410,7 +410,10 @@ static inline int is_sync_wait(wait_queue_t *wait) static inline int is_sync_wait_bit_queue(struct wait_bit_queue *wq) { - return is_sync_wait(&wq->wait); + if (wq) + return is_sync_wait(&wq->wait); + + return 1; } #define in_aio(tsk) is_sync_wait_bit_queue((tsk)->io_wait) -- 2.25.1