From: Suparna Bhattacharya <suparna@in.ibm.com>
To: Anton Altaparmakov <aia21@cam.ac.uk>
Cc: Benjamin LaHaise <bcrl@kvack.org>, Andrew Morton <akpm@osdl.org>,
Linus Torvalds <torvalds@osdl.org>,
linux-aio@kvack.org, lkml <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 2.6-bk] aio not returning error code(?)
Date: Thu, 8 Jul 2004 19:00:29 +0530 [thread overview]
Message-ID: <20040708133029.GA3459@in.ibm.com> (raw)
In-Reply-To: <1089291383.5891.69.camel@imp.csi.cam.ac.uk>
On Thu, Jul 08, 2004 at 01:56:24PM +0100, Anton Altaparmakov wrote:
> On Wed, 2004-07-07 at 23:33, Benjamin LaHaise wrote:
> > On Wed, Jul 07, 2004 at 02:42:44PM +0100, Anton Altaparmakov wrote:
> > > --- bklinux-2.6/fs/aio.c 2004-07-01 11:19:35.000000000 +0100
> > > +++ bklinux-2.6/fs/aio.c.new 2004-07-07 14:26:19.445631304 +0100
> > > @@ -1086,7 +1086,7 @@ int fastcall io_submit_one(struct kioctx
> > > if (likely(-EIOCBQUEUED == ret))
> > > return 0;
> > > aio_complete(req, ret, 0); /* will drop i/o ref to req */
> > > - return 0;
> > > + return ret;
> >
> > That's wrong: you now get 2 results for the same operation -- an error on
> > the submit, and an event with a return code. In order for the user code
> > to do the right thing, you must only get one or the other. If io_submit
> > fails for a particular iocb, there must be no event returned.
>
> I see. Perhaps the man page for io_sbumit(2) needs to be fixed or at
> least clarified. It states:
>
> "ERRORS
> EINVAL The aio_context specified by ctx_id is invalid. nr
> is less than 0. The iocb at *iocbpp[0] is not prop
> erly initialized, or the operation specified is in
> valid for the file descriptor in the iocb."
>
> Not a single file system in the kernel implements aio_fsync and
> according to the man page for io_submit as far as I understand what is
> written there if I call io_submit for an aio_fsync operation I should
> get an error code EINVAL returned.
>
> You are saying that this is wrong and that no error code is returned
> from io_submit despite its manpage saying that it is so one of the two
> must be wrong, no?
Actually the semantics specified in the man page is reasonable. It is
just that you need to make sure that aio_complete() is not called
for the case where we return an error from io_submit.
In my patchset, I broke up io_submit_one into two portions, aio_setup_iocb,
which checks for these error cases and hence returns rightaway, and then
the actual io submission path, which returns 0, and reports any errors
from the fop aio routines via aio_complete(). So aio_fsync for example,
would return -EINVAL from io_submit.
Does that make sense ?
Regards
Suparna
> --
> Anton Altaparmakov <aia21 at cam.ac.uk> (replace at with @)
> Unix Support, Computing Service, University of Cambridge, CB2 3QH, UK
> Linux NTFS maintainer / IRC: #ntfs on irc.freenode.net
> WWW: http://linux-ntfs.sf.net/, http://www-stu.christs.cam.ac.uk/~aia21/
>
> --
> To unsubscribe, send a message with 'unsubscribe linux-aio' in
> the body to majordomo@kvack.org. For more info on Linux AIO,
> see: http://www.kvack.org/aio/
> Don't email: <a href=mailto:"aart@kvack.org">aart@kvack.org</a>
--
Suparna Bhattacharya (suparna@in.ibm.com)
Linux Technology Center
IBM Software Lab, India
prev parent reply other threads:[~2004-07-08 13:22 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <Pine.LNX.4.60.0407071430170.28653@hermes-1.csi.cam.ac.uk>
2004-07-07 22:33 ` [PATCH 2.6-bk] aio not returning error code(?) Benjamin LaHaise
[not found] ` <1089291383.5891.69.camel@imp.csi.cam.ac.uk>
2004-07-08 13:27 ` Benjamin LaHaise
2004-07-08 13:30 ` Suparna Bhattacharya [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20040708133029.GA3459@in.ibm.com \
--to=suparna@in.ibm.com \
--cc=aia21@cam.ac.uk \
--cc=akpm@osdl.org \
--cc=bcrl@kvack.org \
--cc=linux-aio@kvack.org \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@osdl.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox