From: Samuel Thibault Subject: Re: Tapdisk O_DIRECT breaks read-only-ness Date: Fri, 11 Jul 2008 11:23:27 +0100 Message-ID: <20080711102327.GB4506@implementation.uk.xensource.com> References: <4876DB3E.2060707@cs.ubc.ca> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Return-path: Content-Disposition: inline In-Reply-To: <4876DB3E.2060707@cs.ubc.ca> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Christopher Head Cc: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org Christopher Head, le Thu 10 Jul 2008 21:02:06 -0700, a =E9crit : > 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 passe= d > 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 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 @@ =20 /* Maybe O_DIRECT isn't supported. */ o_flags &=3D ~O_DIRECT; - fd =3D open(name, O_RDWR | O_LARGEFILE); + fd =3D open(name, o_flags); if (fd !=3D -1) DPRINTF("WARNING: Accessing image withou= t" "O_DIRECT! (%s)\n", name); =20