public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jeff Moyer <jmoyer@redhat.com>
To: Zach Brown <zach.brown@oracle.com>
Cc: linux-aio@kvack.org, linux-kernel@vger.kernel.org,
	Benjamin LaHaise <bcrl@kvack.org>,
	Suparna bhattacharya <suparna@in.ibm.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Leonid Ananiev <leonid.i.ananiev@intel.com>
Subject: Re: [PATCH 2/2] aio: propogate post-EIOCBQUEUED errors to completion event
Date: Mon, 19 Feb 2007 17:48:14 -0500	[thread overview]
Message-ID: <x49y7mt4vdd.fsf@segfault.boston.devel.redhat.com> (raw)
In-Reply-To: <20070219213835.4032.87439.sendpatchset@tetsuo.zabbo.net> (Zach Brown's message of "Mon, 19 Feb 2007 13:38:35 -0800 (PST)")

==> On Mon, 19 Feb 2007 13:38:35 -0800 (PST), Zach Brown <zach.brown@oracle.com> said:

Zach> This addresses an oops reported by Leonid Ananiev <leonid.i.ananiev@intel.com>
Zach> as archived at http://lkml.org/lkml/2007/2/8/337.
[snip]
Zach> So this patch introduces a helper, aio_propogate_error(), 

...which is spelled incorrectly:  aio_propagate_error.

Zach> which queues post-submission errors in the iocb so that they are
Zach> given to the user completion event when aio_complete() is
Zach> finally called.

Ugly, but I can't think of a better way to do it, either.

> +
> +	if (kiocbIsInserted(req))
> +		aio_ring_insert_entry(ctx, req);
> +

This confused me at first reading.  If it's inserted, then insert it.
Perhaps KIF_COMPLETED would be a better name?

> +/*
> + * This function is used to make sure that an error is communicated to
> + * userspace on iocb completion without stopping -EIOCBQUEUED from bubbling up
> + * to fs/aio.c from the place where it originated.
> + *
> + * If we have an existing -EIOCBQUEUED it must be returned all the way to
> + * fs/aio.c so that it doesn't double-complete the iocb along with whoever
> + * returned -EIOCBQUEUED..  In that case we put the new error in the iocb.  It
> + * will be returned to userspace *intead of* the first result code given to
> + * aio_complete().  Use this only for errors which must overwrite whatever the
> + * return code might have been.  The first non-zero new_err given to this
> + * function for a given iocb will be returned to userspace.
> + */
> +static inline int aio_propogate_error(struct kiocb *iocb, int existing_err,
> +				      int new_err)
> +{
> +	if (existing_err != -EIOCBQUEUED)
> +		return new_err;
> +	if (!iocb->ki_pending_err)
> +		iocb->ki_pending_err = new_err;
> +	return -EIOCBQUEUED;
> +}
> +

I think that we would ideally cancel the I/Os in flight since we are
going to throw away the results.  However, we don't exactly support
cancellation today.  So, I have no objection to this less optimal
solution.

-Jeff

  reply	other threads:[~2007-02-19 22:50 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-19 21:38 [PATCH 1/2] aio: create aio_ring_insert_entry() function Zach Brown
2007-02-19 21:38 ` [PATCH 2/2] aio: propogate post-EIOCBQUEUED errors to completion event Zach Brown
2007-02-19 22:48   ` Jeff Moyer [this message]
2007-02-19 22:57     ` Zach Brown
2007-02-20 16:57   ` Ananiev, Leonid I
2007-02-20 17:03     ` Chris Mason
2007-02-20 17:17       ` Ananiev, Leonid I
2007-02-20 17:54         ` Chris Mason
2007-02-20 21:09           ` Ananiev, Leonid I
2007-02-21  8:35             ` Ken Chen
2007-02-21  8:44               ` Ananiev, Leonid I
2007-02-21 18:24               ` Zach Brown
2007-02-21 19:15                 ` Ananiev, Leonid I
2007-02-20 17:33   ` Ananiev, Leonid I
2007-02-20 18:26     ` Zach Brown
2007-02-21 14:13   ` Suparna Bhattacharya
2007-02-21 18:34     ` Zach Brown
2007-02-19 22:41 ` [PATCH 1/2] aio: create aio_ring_insert_entry() function Jeff Moyer

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=x49y7mt4vdd.fsf@segfault.boston.devel.redhat.com \
    --to=jmoyer@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=bcrl@kvack.org \
    --cc=leonid.i.ananiev@intel.com \
    --cc=linux-aio@kvack.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=suparna@in.ibm.com \
    --cc=zach.brown@oracle.com \
    /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