mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Badari Pulavarty <pbadari@us.ibm.com>
To: Daniel McNeil <daniel@osdl.org>
Cc: Tobias Diedrich <ranma@gmx.at>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	linux-aio@vger.kernel.org, Andrew Morton <akpm@osdl.org>,
	Suparna Bhattacharya <suparna@in.ibm.com>
Subject: Re: AIO Oops on 2.6.3-mm3
Date: Tue, 2 Mar 2004 11:09:03 -0800	[thread overview]
Message-ID: <200403021109.03994.pbadari@us.ibm.com> (raw)
In-Reply-To: <1078253824.3632.4.camel@ibm-c.pdx.osdl.net>

On Tuesday 02 March 2004 10:57 am, Daniel McNeil wrote:
> I fixed reference counting when the i/o completed before the
> submit path was done referencing the iocb.  This looks
> similar except it is getting a fault. 

I wonder whats different here. Even in this case, IO did complete
with EFAULT. 

Just for argument, if the IO completed correctly (without errors) -
how would it not run into this ? io_submit_one() will call
aio_complete() is the return code is NOT -EIOCBQUEUED.
Isn't it ? How do we prevent calling aio_complete() twice ?

Thanks,
Badari



> > I found the problem.. But no fix yet !!
> >
> > Here is whats happening..
> >
> > io_submit_one() :
> >
> > 	gets iocb with 2 refs
> > 	calls file->f_op->aio_write() which returns EFAULT...
> > 		This calls aio_complete() with EFAULT. aio_complete() drops a ref.
> > 	calls  aio_put_req() which drops a ref - since the count is
> > 			zero it frees iocb.
> > 	Since we got EFAULT, io_submit_one() calls aio_complete()
> > 			with freed up iocb - so we get OOPS.
> >
> > The problem here is we are calling aio_complete() twice.
> >
> > Daneil, didn't you fix this earlier ?
> >
> > int io_submit_one(struct kioctx *ctx, struct iocb __user *user_iocb,
> > {
> >
> > 	...
> > 	 req = aio_get_req(ctx);         /* returns with 2 references to req */
> > 	..
> > 	case IOCB_CMD_PWRITE:
> > 		...
> > 		ret = file->f_op->aio_write(req, buf,
> >                                         iocb->aio_nbytes, req->ki_pos);
> > 	...
> > 	aio_put_req(req);       /* drop extra ref to req */
> >         if (likely(-EIOCBQUEUED == ret))
> >                 return 0;
> >         aio_complete(req, ret, 0);      /* will drop i/o ref to req */
> >         return 0;
> > 	....
> >
> > }
> >
> >
> >
> > Thanks,
> > Badari


  reply	other threads:[~2004-03-02 19:15 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-02-28  2:48 Tobias Diedrich
2004-03-02 17:54 ` Badari Pulavarty
2004-03-02 18:57   ` Daniel McNeil
2004-03-02 19:09     ` Badari Pulavarty [this message]
2004-03-05  1:31   ` [PATCH 2.6.3-mm4] direct_io_worker-aio_complete patch (fixes AIO Oops) Daniel McNeil
2004-03-05 15:39     ` Tobias Diedrich

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=200403021109.03994.pbadari@us.ibm.com \
    --to=pbadari@us.ibm.com \
    --cc=akpm@osdl.org \
    --cc=daniel@osdl.org \
    --cc=linux-aio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ranma@gmx.at \
    --cc=suparna@in.ibm.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

all inboxes | Powered by JetHome®