lkml.org 
[lkml]   [2003]   [Jun]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Subject[PATCH 2.5.71-mm1] aio process hang on EINVAL
From
Date
Andrew,

Here is a patch to fix EINVAL handling in io_submit_one() that was
causing a process hang when attempting AIO to a device not able
to handle aio. I hit this doing a AIO read from /dev/zero. The
process would hang on exit in wait_for_all_aios(). The fix is
to check for EINVAL coming back from aio_setup_iocb() in addition
to the EFAULT and EBADF already there. This causes the io_submit
to fail with EINVAL. That check looks error prone.
Are there other error return values where it should jump to the
aio_put_req()? Should the check be:

if (ret != 0 && ret != -EIOCBQUEUED)
goto out_put_req;
Thanks,

Daniel McNeil <daniel@osdl.org>
diff -rupN -X /home/daniel_nfs/dontdiff linux-2.5.71-mm1/fs/aio.c linux-2.5.71-mm1.patch/fs/aio.c
--- linux-2.5.71-mm1/fs/aio.c 2003-06-16 15:17:22.000000000 -0700
+++ linux-2.5.71-mm1.patch/fs/aio.c 2003-06-16 16:46:27.515255621 -0700
@@ -1504,7 +1504,7 @@ int io_submit_one(struct kioctx *ctx, st

ret = aio_setup_iocb(req, iocb);

- if ((-EBADF == ret) || (-EFAULT == ret))
+ if ((-EBADF == ret) || (-EFAULT == ret) || (-EINVAL == ret))
goto out_put_req;

spin_lock_irq(&ctx->ctx_lock);
\
 
 \ /
  Last update: 2005-03-22 13:36    [from the cache]
©2003-2011 Jasper Spaans