From: Eric Blake <eblake@redhat.com>
To: Alex Bligh <alex@alex.org.uk>
Cc: Kevin Wolf <kwolf@redhat.com>,
Deepak C Shetty <deepakcs@linux.vnet.ibm.com>,
qemu-devel@nongnu.org, Stefan Hajnoczi <stefanha@redhat.com>,
Markus Armbruster <armbru@redhat.com>
Subject: Re: [Qemu-devel] [PATCH 2/2] osdep: warn if open(O_DIRECT) on fails with EINVAL
Date: Thu, 22 Aug 2013 13:38:32 -0600 [thread overview]
Message-ID: <521668B8.6050203@redhat.com> (raw)
In-Reply-To: <4C5A7A1D9E0FC7CCAEA83FA1@nimrod.local>
[-- Attachment #1: Type: text/plain, Size: 1743 bytes --]
On 08/22/2013 01:31 PM, Alex Bligh wrote:
>
>
> --On 22 August 2013 11:57:56 -0600 Eric Blake <eblake@redhat.com> wrote:
>
>> # define O_DIRECT 0
>>
>> so that the rest of the code can just blindly use open(...,|O_DIRECT)
>> (provided, of course, that not having O_DIRECT semantics is not
>> fatal...). If that is done, then this #ifdef will always be true...
>
> I think this is undesirable as the result of opening without O_DIRECT
> when you really wanted O_DIRECT could be subtle data corruption due
> to unexpected caching. Is an error not more appropriate here than
> proceeding regardless?
As I said in the surrounding text you snipped:
>
> On some other projects I've worked with (hello gnulib!), the
> compatibility headers do:
...
>
> But enough of that side diversion - that one #define of O_DIRECT is not
> related to the file you are touching.
Qemu doesn't define O_DIRECT to 0 for the mere sake of compilation, and
I'm not arguing that it should. I was more making sure that this patch
was correct, by reassuring myself the policies that qemu uses for
O_DIRECT (and since I demonstrated that other projects have other
policies). As to whether other projects may have a bug when using
O_DIRECT being 0, it is a problem for those projects to deal with.
Besides, O_DIRECT is a non-POSIX extension, so anyone using it already
has non-portability issues to think about, regardless of whether the
fallback for platforms that lack it is done by always defining to 0 or
always using #ifdef guards.
Thus, my diversion about other projects using O_DIRECT as 0 is a non-issue.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 621 bytes --]
next prev parent reply other threads:[~2013-08-22 19:39 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-22 9:29 [Qemu-devel] [PATCH 0/2] osdep: warn if open(O_DIRECT) on fails with EINVAL Stefan Hajnoczi
2013-08-22 9:29 ` [Qemu-devel] [PATCH 1/2] libcacard: link against qemu-error.o for error_report() Stefan Hajnoczi
2013-08-22 9:29 ` [Qemu-devel] [PATCH 2/2] osdep: warn if open(O_DIRECT) on fails with EINVAL Stefan Hajnoczi
2013-08-22 17:57 ` Eric Blake
2013-08-22 19:31 ` Alex Bligh
2013-08-22 19:38 ` Eric Blake [this message]
2013-09-06 20:32 ` Jeff Cody
2013-09-18 13:21 ` Stefan Hajnoczi
2013-09-18 13:47 ` [Qemu-devel] [PATCH 0/2] " Stefan Hajnoczi
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=521668B8.6050203@redhat.com \
--to=eblake@redhat.com \
--cc=alex@alex.org.uk \
--cc=armbru@redhat.com \
--cc=deepakcs@linux.vnet.ibm.com \
--cc=kwolf@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.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).