[PATCH 2.5.71-mm1] aio process hang on EINVAL

Daniel McNeil (daniel@osdl.org)
16 Jun 2003 17:43:28 -0700

This is a MIME-formatted message. If you see this text it means that your
E-mail software does not support MIME-formatted messages.

Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 7bit


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;


Daniel McNeil <daniel@osdl.org>

Content-Type: text/x-patch; name="patch.2.5.71-mm1.aio"; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment; filename=patch.2.5.71-mm1.aio

diff -rupN -X /home/daniel_nfs/dontdiff linux-2.5.71-mm1/fs/aio.c linux-2.5=
--- 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 =3D aio_setup_iocb(req, iocb);
- if ((-EBADF =3D=3D ret) || (-EFAULT =3D=3D ret))
+ if ((-EBADF =3D=3D ret) || (-EFAULT =3D=3D ret) || (-EINVAL =3D=3D ret))
goto out_put_req;