]> git.hungrycats.org Git - linux/commitdiff
[PATCH] AIO/DIO oops fix
authorBadari Pulavarty <pbadari@us.ibm.com>
Wed, 8 Sep 2004 00:56:52 +0000 (17:56 -0700)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Wed, 8 Sep 2004 00:56:52 +0000 (17:56 -0700)
The problem here is, finished_one_bio() shouldn't call aio_complete() since
no work has been done.  I have a fix for this - can you verify this ?  I am
not really comfortable with this "tweaking".  (I am not really sure about
IO errors like EIO etc.  - if they can lead to calling aio_complete()
twice)

Fix is to call aio_complete() ONLY if there is something to report.  Note
the we don't update dio->result with any error codes from get_user_pages(),
they just passed as "ret" value from do_direct_IO().

Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
fs/direct-io.c

index 276905778c00febf793b33bc6c153d9d57427f15..6ab1283adf9a9b325696f46a6f53e9a905c4fcec 100644 (file)
@@ -235,7 +235,8 @@ static void finished_one_bio(struct dio *dio)
                        dio_complete(dio, dio->block_in_file << dio->blkbits,
                                        dio->result);
                        /* Complete AIO later if falling back to buffered i/o */
-                       if (dio->result == dio->size || dio->rw == READ) {
+                       if (dio->result == dio->size ||
+                               ((dio->rw == READ) && dio->result)) {
                                aio_complete(dio->iocb, dio->result, 0);
                                kfree(dio);
                                return;