linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@digeo.com>
To: Steve Lord <lord@sgi.com>
Cc: Linux Kernel <linux-kernel@vger.kernel.org>
Subject: Re: 2.5 O)DIRECT problem
Date: Fri, 04 Oct 2002 13:29:40 -0700	[thread overview]
Message-ID: <3D9DFA34.581D9D98@digeo.com> (raw)
In-Reply-To: 1033762674.2457.73.camel@jen.americas.sgi.com

Steve Lord wrote:
> 
> Hi Andrew,
> 
> I ran into a problem with 2.5's O_DIRECT read path,
> 
>         generic_file_direct_IO usually ends up in generic_direct_IO
>         this does bounds checking on the I/O and then flushes any
>         cached data.
> 
>         Once we return to generic_file_direct_IO we unconditionally
>         call invalidate_inode_pages2 if there are any cached pages.
> 
> If we make a non-aligned O_DIRECT read call, the end result is we
> call invalidate_inode_pages2, but we do not do the filemap_fdatawrite,
> filemap_fdatawait calls. End result is we throw the buffered data away.

Well you could always switch to Linus' current BK tree, in
which invalidate_inode_pages2() is a no-op (whoops).

> Either the flush needs to happen before the bounds checks, or the
> invalidate should only be done on a successful write. It looks
> pretty hard to detect the latter case with the current structure,
> we can get EINVAL from the bounds check and possibly from an
> aligned, but invalid memory address being passed in.

Yes I agree; let's just do the sync before any checks.

I think it should be moved into generic_file_direct_IO(),
because that's the place where the invalidation happens, yes?

  reply	other threads:[~2002-10-04 20:24 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-10-04 20:17 2.5 O)DIRECT problem Steve Lord
2002-10-04 20:29 ` Andrew Morton [this message]
2002-10-04 20:38   ` Steve Lord
2002-10-04 20:51     ` Andrew Morton

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=3D9DFA34.581D9D98@digeo.com \
    --to=akpm@digeo.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lord@sgi.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;
as well as URLs for NNTP newsgroup(s).