* Tapdisk O_DIRECT breaks read-only-ness
@ 2008-07-11 4:02 Christopher Head
2008-07-11 10:23 ` Samuel Thibault
0 siblings, 1 reply; 2+ messages in thread
From: Christopher Head @ 2008-07-11 4:02 UTC (permalink / raw)
To: xen-devel
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi all,
It looks like some time ago a patch was applied to the Tapdisk backend
drivers to add O_DIRECT to the open system calls whenever possible.
However, on line 141 of tools/blktap/drivers/block-sync.c, at least as
of revision 16947:f66bb3b80661 of Xen 3.2, it looks like there's a
slight logic error: this line is where the open() system call is
repeated without O_DIRECT (in case O_DIRECT fails), but instead of
passing in o_flags as the second parameter, O_RDWR|O_LARGEFILE is passed
directly. This means that if tap:sync is unable to open a file with
O_DIRECT, it will then attempt to open the file read-write even if the
original request was for a read-only open.
Chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.9 (GNU/Linux)
Comment: GnuPT 2.7.2
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iEYEARECAAYFAkh22z0ACgkQiD2svb/jCb7WMACbBCK02IfXqXJ76X1gZHgdFUM8
y/QAoJGIuljAh1O/tNBD5zeuMlxU8Om7
=kp2J
-----END PGP SIGNATURE-----
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Tapdisk O_DIRECT breaks read-only-ness
2008-07-11 4:02 Tapdisk O_DIRECT breaks read-only-ness Christopher Head
@ 2008-07-11 10:23 ` Samuel Thibault
0 siblings, 0 replies; 2+ messages in thread
From: Samuel Thibault @ 2008-07-11 10:23 UTC (permalink / raw)
To: Christopher Head; +Cc: xen-devel
Christopher Head, le Thu 10 Jul 2008 21:02:06 -0700, a écrit :
> However, on line 141 of tools/blktap/drivers/block-sync.c, at least as
> of revision 16947:f66bb3b80661 of Xen 3.2, it looks like there's a
> slight logic error: this line is where the open() system call is
> repeated without O_DIRECT (in case O_DIRECT fails), but instead of
> passing in o_flags as the second parameter, O_RDWR|O_LARGEFILE is passed
> directly.
tapdisk: in case O_DIRECT fails, retry again with o_flags but O_DIRECT,
instead of fixed value O_RD_WR | O_LARGEFILE
Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
diff -r 06d80308aa2e tools/blktap/drivers/block-sync.c
--- a/tools/blktap/drivers/block-sync.c Thu Jul 10 19:23:55 2008 +0100
+++ b/tools/blktap/drivers/block-sync.c Fri Jul 11 11:21:58 2008 +0100
@@ -129,7 +129,7 @@
/* Maybe O_DIRECT isn't supported. */
o_flags &= ~O_DIRECT;
- fd = open(name, O_RDWR | O_LARGEFILE);
+ fd = open(name, o_flags);
if (fd != -1) DPRINTF("WARNING: Accessing image without"
"O_DIRECT! (%s)\n", name);
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-07-11 10:23 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-11 4:02 Tapdisk O_DIRECT breaks read-only-ness Christopher Head
2008-07-11 10:23 ` Samuel Thibault
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.