From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:57929) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T7D1Q-00008X-F0 for qemu-devel@nongnu.org; Thu, 30 Aug 2012 18:15:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T7D1P-0005DR-Am for qemu-devel@nongnu.org; Thu, 30 Aug 2012 18:15:32 -0400 Received: from mx1.redhat.com ([209.132.183.28]:16929) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T7D1P-0005DL-2a for qemu-devel@nongnu.org; Thu, 30 Aug 2012 18:15:31 -0400 Message-ID: <503FE5FC.1040002@redhat.com> Date: Thu, 30 Aug 2012 15:15:24 -0700 From: Eric Blake MIME-Version: 1.0 References: <7ad1da59f3ef71e4c99c083a0675508ca9279c53.1346352124.git.jcody@redhat.com> In-Reply-To: <7ad1da59f3ef71e4c99c083a0675508ca9279c53.1346352124.git.jcody@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="------------enigDD9954E950221E32BBAC5332" Subject: Re: [Qemu-devel] [PATCH 3/7] block: raw-posix image file reopen List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jeff Cody Cc: kwolf@redhat.com, pbonzini@redhat.com, stefanha@gmail.com, qemu-devel@nongnu.org, supriyak@linux.vnet.ibm.com This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enigDD9954E950221E32BBAC5332 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 08/30/2012 11:47 AM, Jeff Cody wrote: > This is derived from the Supriya Kannery's reopen patches. >=20 > This contains the raw-posix driver changes for the bdrv_reopen_* > functions. All changes are staged into a temporary scratch buffer > during the prepare() stage, and copied over to the live structure > during commit(). Upon abort(), all changes are abandoned, and the > live structures are unmodified. >=20 > The _prepare() will create an extra fd - either by means of a dup, > if possible, or opening a new fd if not (for instance, access > control changes). Upon _commit(), the original fd is closed and > the new fd is used. Upon _abort(), the duplicate/new fd is closed. >=20 > + if ((raw_s->open_flags & ~fcntl_flags) =3D=3D (s->open_flags & ~fc= ntl_flags)) { > + /* dup the original fd */ > + /* TODO: use qemu fcntl wrapper */ > + raw_s->fd =3D fcntl(s->fd, F_DUPFD_CLOEXEC, 0); I assume this TODO has to be fixed to allow compilation on systems that lack F_DUPFD_CLOEXEC. > + if (raw_s->fd =3D=3D -1) { > + ret =3D -1; > + goto error; > + } > + ret =3D fcntl_setfl(raw_s->fd, raw_s->open_flags); > + } else { > + raw_s->fd =3D qemu_open(state->bs->filename, raw_s->open_flags= , 0644); Is raw_s->open_flags every going to contain O_CREAT, or is the 0644 mode argument spurious? --=20 Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --------------enigDD9954E950221E32BBAC5332 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Mozilla - http://www.enigmail.net/ iQEcBAEBCAAGBQJQP+X9AAoJEKeha0olJ0NqOKoH/1PRGf9cXuLTz9hFLvYwxtkD +rl6/Yo0KmXziSaRFIa63wQe56TsFSkqdsY1YBOKkMofcD5NFsH7clqRTgxKH48p M/5qEpIZJjfQYE9Yly0lHVIm3oRhwVD3YptrpxEqhn3quNR0I0KbynP0fdexYx00 b/vMBXqIYH/6ueThpMBiP7gRrF3WYBKOUbxZqNmppQL7qKSt6Ra0UpSQqhzbS0he ja8GJLZnfupRsH4shsHJPZA3Vpjtszzzh1ZZrioj5aimh26XT7k7AY9MZ76W7pwx MlSehwkfmjojafZf+s5hkLfQyErzufWB0m4qDszE0ALoAinyLQGKf0xa5M2EArs= =9+aM -----END PGP SIGNATURE----- --------------enigDD9954E950221E32BBAC5332--