[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.

--=_courier-13995-1055810713-0001-2
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 7bit

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>

--=_courier-13995-1055810713-0001-2
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=
.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
=20
ret =3D aio_setup_iocb(req, iocb);
=20
- 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;
=20
spin_lock_irq(&ctx->ctx_lock);

--=_courier-13995-1055810713-0001-2--