From: Daniel McNeil 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; fs/aio.c | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) diff -puN fs/aio.c~io_submit_one-EINVAL-fix fs/aio.c --- 25/fs/aio.c~io_submit_one-EINVAL-fix 2003-06-16 21:43:03.000000000 -0700 +++ 25-akpm/fs/aio.c 2003-06-16 21:43:14.000000000 -0700 @@ -1436,7 +1436,7 @@ int io_submit_one(struct kioctx *ctx, st ret = aio_setup_iocb(req); - if ((-EBADF == ret) || (-EFAULT == ret)) + if (ret) goto out_put_req; spin_lock_irq(&ctx->ctx_lock); _