public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Benjamin LaHaise <bcrl@kvack.org>
To: Anton Altaparmakov <aia21@cam.ac.uk>
Cc: 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 09:27:45 -0400	[thread overview]
Message-ID: <20040708132745.GG6513@kvack.org> (raw)
In-Reply-To: <1089291383.5891.69.camel@imp.csi.cam.ac.uk>

Hello Anton,

On Thu, Jul 08, 2004 at 01:56:24PM +0100, Anton Altaparmakov wrote:
> 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?

Either or.  Yes, the man page needs to talk about early vs late errors 
(remember that any early error for a given iocb is valid late), or your 
patch needs to be fixed.  Something like the following would be the 
right way of fixing it -- it doesn't report the same error twice (both 
early and late) as your patch did, but it's not clear which was is better.  
There are good arguements in favour of both early and late error 
reporting, and late errors must always be handled by the application.  I 
hope this clears things up to the level of mud. ;-)  Cheers,

		-ben
-- 
"Time is what keeps everything from happening all at once." -- John Wheeler


--- fs/aio.c.orig	2004-07-08 09:18:02.208534208 -0400
+++ fs/aio.c	2004-07-08 09:23:42.346825328 -0400
@@ -1044,6 +1044,8 @@
 		if (file->f_op->aio_read)
 			ret = file->f_op->aio_read(req, buf,
 					iocb->aio_nbytes, req->ki_pos);
+		else
+			goto out_put_req;
 		break;
 	case IOCB_CMD_PWRITE:
 		ret = -EBADF;
@@ -1059,20 +1061,27 @@
 		if (file->f_op->aio_write)
 			ret = file->f_op->aio_write(req, buf,
 					iocb->aio_nbytes, req->ki_pos);
+		else
+			goto out_put_req;
 		break;
 	case IOCB_CMD_FDSYNC:
 		ret = -EINVAL;
 		if (file->f_op->aio_fsync)
 			ret = file->f_op->aio_fsync(req, 1);
+		else
+			goto out_put_req;
 		break;
 	case IOCB_CMD_FSYNC:
 		ret = -EINVAL;
 		if (file->f_op->aio_fsync)
 			ret = file->f_op->aio_fsync(req, 0);
+		else
+			goto out_put_req;
 		break;
 	default:
 		dprintk("EINVAL: io_submit: no operation provided\n");
 		ret = -EINVAL;
+		goto out_put_req;
 	}
 
 	aio_put_req(req);	/* drop extra ref to req */

  parent reply	other threads:[~2004-07-08 13:28 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 [this message]
2004-07-08 13:30     ` Suparna Bhattacharya

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=20040708132745.GG6513@kvack.org \
    --to=bcrl@kvack.org \
    --cc=aia21@cam.ac.uk \
    --cc=akpm@osdl.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