From: Kent Overstreet <koverstreet@google.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Hillf Danton <dhillf@gmail.com>,
Valdis.Kletnieks@vt.edu, bcrl@kvack.org, zab@zabbo.net,
linux-kernel@vger.kernel.org, linux-aio@kvack.org,
linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH 3/3] aio-use-cancellation-list-lazily-fix
Date: Mon, 28 Jan 2013 09:37:33 -0800 [thread overview]
Message-ID: <20130128173733.GV26407@google.com> (raw)
In-Reply-To: <20130125151251.0c90bf4b.akpm@linux-foundation.org>
On Fri, Jan 25, 2013 at 03:12:51PM -0800, Andrew Morton wrote:
> On Fri, 25 Jan 2013 21:30:32 +0800
> Hillf Danton <dhillf@gmail.com> wrote:
>
> > On Fri, Jan 25, 2013 at 5:43 AM, Kent Overstreet <koverstreet@google.com> wrote:
> > > The cancellation changes were fubar - we can't cancel a kiocb if it
> > > doesn't actually have a cancellation callback.
> > >
> > > The use of xchg() in aio_complete() was right - there we're marking the
> > > kiocb as completed - but we need to use cmpxchg() in kiocb_cancel() - a
> > > lock isn't sufficient since we're synchronizing with aio_complete()
> > > which isn't taking any locks.
> > >
> > > static int kiocb_cancel(struct kioctx *ctx, struct kiocb *kiocb,
> > > struct io_event *res)
> > > {
> > > - kiocb_cancel_fn *cancel;
> > > + kiocb_cancel_fn *old, *cancel;
> > > int ret = -EINVAL;
> > >
> > > - cancel = xchg(&kiocb->ki_cancel, KIOCB_CANCELLED);
> > > - if (!cancel || cancel == KIOCB_CANCELLED)
> > > - return ret;
> > > + /*
> > > + * Don't want to set kiocb->ki_cancel = KIOCB_CANCELLED unless it
> > > + * actually has a cancel function, hence the cmpxchg()
> > > + */
> > > +
> > > + cancel = ACCESS_ONCE(kiocb->ki_cancel);
> > > + do {
> > > + if (!cancel || cancel == KIOCB_CANCELLED)
> > > + return ret;
> > > +
> > > + BUG();
> >
> > Hmm, what is trapped?
> >
> > > + old = cancel;
> > > + cancel = cmpxchg(&kiocb->ki_cancel, old, KIOCB_CANCELLED);
> > > + } while (cancel != old);
>
> erk, I missed that. What earthly sense is there in putting a BUG() in
> that place.
>
> I think I'll delete it and pretend I never saw it :(
Argh. Yeah, sorry about that. Put that in there when I was trying to
track down the other bugs :(
--
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>
prev parent reply other threads:[~2013-01-28 17:37 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <3544.1358774694@turing-police.cc.vt.edu>
[not found] ` <CAJd=RBBBbv07aoOTF=PNy1FpCyuRV7fnQEGX_DXEYFSSknKtqQ@mail.gmail.com>
[not found] ` <2553.1358890098@turing-police.cc.vt.edu>
[not found] ` <CAJd=RBCHRDzyjY_hOZCj6rHBXzb3f5wWxdqXYuLbQXLe2n4JeA@mail.gmail.com>
[not found] ` <13450.1359048141@turing-police.cc.vt.edu>
[not found] ` <20130124211850.GH26407@google.com>
2013-01-24 21:27 ` next-20130117 - kernel BUG with aio Andrew Morton
2013-01-24 21:39 ` Kent Overstreet
2013-01-24 22:25 ` Zach Brown
2013-01-24 22:47 ` Jeff Moyer
2013-01-24 23:03 ` Kent Overstreet
2013-01-24 22:13 ` Kent Overstreet
2013-01-29 13:41 ` Jan Kara
2013-01-24 21:43 ` [PATCH 1/3] aio: Fix a null pointer deref in batch_complete_aio Kent Overstreet
2013-01-25 13:15 ` Hillf Danton
2013-01-24 21:43 ` [PATCH 2/3] aio-kill-ki_retry-fix-fix Kent Overstreet
2013-01-24 21:43 ` [PATCH 3/3] aio-use-cancellation-list-lazily-fix Kent Overstreet
2013-01-25 13:30 ` Hillf Danton
2013-01-25 23:12 ` Andrew Morton
2013-01-28 17:37 ` Kent Overstreet [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=20130128173733.GV26407@google.com \
--to=koverstreet@google.com \
--cc=Valdis.Kletnieks@vt.edu \
--cc=akpm@linux-foundation.org \
--cc=bcrl@kvack.org \
--cc=dhillf@gmail.com \
--cc=linux-aio@kvack.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=zab@zabbo.net \
/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;
as well as URLs for NNTP newsgroup(s).