All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Jan Kara <jack@suse.cz>
Cc: Christoph Hellwig <hch@lst.de>,
	linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH 2/2] fs: update atime before I/O in generic_file_read_iter
Date: Tue, 4 Oct 2016 13:48:30 +0200	[thread overview]
Message-ID: <20161004114830.GA2359@lst.de> (raw)
In-Reply-To: <20161004081324.GC17515@quack2.suse.cz>

On Tue, Oct 04, 2016 at 10:13:24AM +0200, Jan Kara wrote:
> But frankly it looks like a nasty catch that iocb->ki_filp can go away
> under you in the AIO case. Do I get it right that this means there must be
> some other thread closing your fd while the read is running, right?

Yes, that's what generic/323 tests.

> Also it seems that file_end_write(file) call in aio_run_iocb() is prone to
> the same race?

Indeed.  That's easy to fix by moving the file_end_write to aio_complete,
though.

> Won't we be better off to just to do additional get_file() / fput() pair in
> the AIO submission path so that whole AIO submission path is guaranteed to
> have struct file available? I understand this is very performance sensitive
> path but we'll be adding just two atomic ops...

I'd rather avoid those if we can.  But a big comment and some refactoring
in this area would be useful to make that easier to understand.

  reply	other threads:[~2016-10-04 11:48 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-30  8:46 fix struct file use after free in the AIO read path Christoph Hellwig
2016-09-30  8:46 ` [PATCH 1/2] xfs: update atime before I/O in xfs_file_dio_aio_read Christoph Hellwig
2016-09-30  8:46 ` [PATCH 2/2] fs: update atime before I/O in generic_file_read_iter Christoph Hellwig
2016-10-04  8:13   ` Jan Kara
2016-10-04 11:48     ` Christoph Hellwig [this message]
2016-10-05  8:29       ` Jan Kara

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=20161004114830.GA2359@lst.de \
    --to=hch@lst.de \
    --cc=jack@suse.cz \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-xfs@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.