linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Theodore Ts'o <tytso@mit.edu>
To: Dave Chinner <david@fromorbit.com>
Cc: Dmitry Monakhov <dmonlist@gmail.com>,
	Ext4 Developers List <linux-ext4@vger.kernel.org>
Subject: Re: [PATCH] ext4: refuse O_DIRECT opens for mode where DIO doesn't work
Date: Mon, 25 Apr 2016 20:20:38 -0400	[thread overview]
Message-ID: <20160426002038.GA28496@thunk.org> (raw)
In-Reply-To: <20160425234946.GB26977@dastard>

On Tue, Apr 26, 2016 at 09:49:46AM +1000, Dave Chinner wrote:
> Why not just transparently fall back to buffered IO if direct IO
> cannot be done? Saves people from wondering why applications fail
> on one ext4 filesystem and not another....

Some file systems return EINVAL if they don't support O_DIRECT.  In
fact, _require_odirect in xfstests relies on this fact.  The question
of whether it's better to silently fall back to buffered I/O and fail
to provide the O_DIRECT functionality requested by the user, or
whether it's better to fail with EINVAL is an interesting one.  It is
possible for applications (or xfstests tests) that expect O_DIRECT
functionality but don't get it can end up fail, sometimes in subtle
ways that might be tricky to debug.

It would be nice if there was some way to answer the question, "does
O_DIRECT work or is it a placebo", perhaps via an extension to
statfs(2), but we don't have that today.

I ran into this because I was investigating an xfstests failure, and
it was because we were claiming to support O_DIRECT when in fact we
weren't, and this was causing a test failure.  OTOH, after I applied
this patch, there were a handful of tests that are using O_DIRECT
without using the _require_odirect assertion, and we were passing
those tests essentially by luck.

So depending how we decide to deal with this case, I can send patches
that add the missing _require_odirect to those tests, and/or send
tests that add more ext4-specific checks to _require_odirect (e.g.,
don't try to use O_DIRECT in data=journal, or if inline_data is
enabled, or if encryption is enabled).

What do folks think?

					- Ted

  reply	other threads:[~2016-04-26  0:20 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-24  4:27 [PATCH] ext4: refuse O_DIRECT opens for mode where DIO doesn't work Theodore Ts'o
2016-04-25  9:35 ` Dmitry Monakhov
2016-04-25 23:49   ` Dave Chinner
2016-04-26  0:20     ` Theodore Ts'o [this message]
2016-04-26  8:14     ` O_DIRECT as a hint, was: " Christoph Hellwig
2016-04-26 15:07       ` Mike Marshall
     [not found]       ` <20160426081451.GA25616-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
2016-04-27  2:16         ` Theodore Ts'o
     [not found]           ` <20160427021649.GA30021-AKGzg7BKzIDYtjvyW6yDsg@public.gmane.org>
2016-04-27  2:22             ` Eric Sandeen
2016-04-27  2:25           ` Dave Chinner
2016-04-27  2:27         ` Dave Chinner
2016-04-27  3:25           ` Theodore Ts'o
     [not found]             ` <20160427032526.GC30021-AKGzg7BKzIDYtjvyW6yDsg@public.gmane.org>
2016-04-27  3:37               ` Dave Chinner

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=20160426002038.GA28496@thunk.org \
    --to=tytso@mit.edu \
    --cc=david@fromorbit.com \
    --cc=dmonlist@gmail.com \
    --cc=linux-ext4@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 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).