aio: buffered oops fix
authorJens Axboe <jens.axboe@oracle.com>
Tue, 13 Jan 2009 12:59:21 +0000 (13:59 +0100)
committerJens Axboe <jens.axboe@oracle.com>
Sat, 26 Sep 2009 15:31:59 +0000 (17:31 +0200)
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
fs/aio.c
include/linux/wait.h

index 961f62a321091efafdb0fe7dd6279ff52d4c8ab2..39ee8d1cbc0a1b51cafadb2fb39ac7ea1ccfb4e6 100644 (file)
--- 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);
                }
index 586198803c0d658145347e12a952d9c32eb3c351..c5e20bbf26c3bb76d971b8ae63d2731cfd46f95f 100644 (file)
@@ -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)