From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:33686) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QpKCz-00084f-1r for qemu-devel@nongnu.org; Fri, 05 Aug 2011 09:13:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QpKCt-00024I-GD for qemu-devel@nongnu.org; Fri, 05 Aug 2011 09:13:00 -0400 Received: from mx1.redhat.com ([209.132.183.28]:5387) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QpKCt-00024C-7r for qemu-devel@nongnu.org; Fri, 05 Aug 2011 09:12:55 -0400 Date: Fri, 5 Aug 2011 14:12:48 +0100 From: "Daniel P. Berrange" Message-ID: <20110805131247.GC6201@redhat.com> References: <4E3BB203.5060703@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] Safely reopening image files by stashing fds Reply-To: "Daniel P. Berrange" List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: Kevin Wolf , Paolo Bonzini , Anthony Liguori , qemu-devel , Supriya Kannery On Fri, Aug 05, 2011 at 10:27:00AM +0100, Stefan Hajnoczi wrote: > On Fri, Aug 5, 2011 at 10:04 AM, Paolo Bonzini wr= ote: > > On 08/05/2011 10:40 AM, Stefan Hajnoczi wrote: > >> > >> 4. Implement bdrv_reopen() > >> > >> First call bdrv_extract_fds() to stash the file descriptors, then cl= ose > >> the > >> block device. =C2=A0Try opening the new image but if that fails, reo= pen using > >> the > >> stashed file descriptors. > > > > Why not do the latter unconditionally? >=20 > Because you cannot change O_DIRECT on an open fd :(. This is why > we're going through this pain. Hmm, I remember hearing that before, but looking at the current fcntl() manpage, it claims you *can* change O_DIRECT using SET_FL. Perhaps this is a newish feature, but it'd be nicer to use it if possible ? [man 2 fcntl] F_SETFL (long) Set the file status flags to the value specified by arg. = File access mode (O_RDONLY, O_WRONLY, O_RDWR) and file creation = flags (i.e., O_CREAT, O_EXCL, O_NOCTTY, O_TRUNC) in arg are ign= ored. On Linux this command can only change the O_APPEND, O_A= SYNC, O_DIRECT, O_NOATIME, and O_NONBLOCK flags. [/man] Regards, Daniel --=20 |: http://berrange.com -o- http://www.flickr.com/photos/dberrange= / :| |: http://libvirt.org -o- http://virt-manager.or= g :| |: http://autobuild.org -o- http://search.cpan.org/~danberr= / :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vn= c :|