[Qemu-devel] Safely reopening image files by stashing fds

2011-08-05 Thread Stefan Hajnoczi
We've discussed safe methods for reopening image files (e.g. useful for changing the hostcache parameter). The problem is that closing the file first and then opening it again exposes us to the error case where the open fails. At that point we cannot get to the file anymore and our options are to

Re: [Qemu-devel] Safely reopening image files by stashing fds

2011-10-10 Thread Kevin Wolf
Am 09.08.2011 11:22, schrieb supriya kannery: > Kevin Wolf wrote: >> Am 08.08.2011 09:02, schrieb Supriya Kannery: >> >>> On 08/05/2011 09:19 PM, Anthony Liguori wrote: >>> On 08/05/2011 10:43 AM, Kevin Wolf wrote: > Am 05.08.2011 17:24, schrieb Stefan Hajnoczi: >

Re: [Qemu-devel] Safely reopening image files by stashing fds

2011-10-10 Thread Supriya Kannery
On 10/10/2011 11:58 PM, Kevin Wolf wrote: Am 09.08.2011 11:22, schrieb supriya kannery: Kevin Wolf wrote: Am 08.08.2011 09:02, schrieb Supriya Kannery: On 08/05/2011 09:19 PM, Anthony Liguori wrote: On 08/05/2011 10:43 AM, Kevin Wolf wrote: Am 05.08.2011 17:24, schrieb Stefan Hajnoczi:

Re: [Qemu-devel] Safely reopening image files by stashing fds

2011-08-05 Thread Paolo Bonzini
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 close the block device. Try opening the new image but if that fails, reopen using the stashed file descriptors. Why not do the latter unconditionally? P

Re: [Qemu-devel] Safely reopening image files by stashing fds

2011-08-05 Thread Kevin Wolf
Am 05.08.2011 10:40, schrieb Stefan Hajnoczi: > We've discussed safe methods for reopening image files (e.g. useful for > changing the hostcache parameter). The problem is that closing the file first > and then opening it again exposes us to the error case where the open fails. > At that point we

Re: [Qemu-devel] Safely reopening image files by stashing fds

2011-08-05 Thread Stefan Hajnoczi
On Fri, Aug 5, 2011 at 10:04 AM, Paolo Bonzini wrote: > 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 close >> the >> block device.  Try opening the new image but if that fails, reopen using >

Re: [Qemu-devel] Safely reopening image files by stashing fds

2011-08-05 Thread Stefan Hajnoczi
On Fri, Aug 5, 2011 at 10:07 AM, Kevin Wolf wrote: > Am 05.08.2011 10:40, schrieb Stefan Hajnoczi: >> We've discussed safe methods for reopening image files (e.g. useful for >> changing the hostcache parameter).  The problem is that closing the file >> first >> and then opening it again exposes u

Re: [Qemu-devel] Safely reopening image files by stashing fds

2011-08-05 Thread Kevin Wolf
Am 05.08.2011 11:29, schrieb Stefan Hajnoczi: > On Fri, Aug 5, 2011 at 10:07 AM, Kevin Wolf wrote: >> Am 05.08.2011 10:40, schrieb Stefan Hajnoczi: >>> We've discussed safe methods for reopening image files (e.g. useful for >>> changing the hostcache parameter). The problem is that closing the fi

Re: [Qemu-devel] Safely reopening image files by stashing fds

2011-08-05 Thread Paolo Bonzini
On 08/05/2011 11:27 AM, Stefan Hajnoczi wrote: First call bdrv_extract_fds() to stash the file descriptors, then close the block device. Try opening the new image but if that fails, reopen using the stashed file descriptors. Why not do the latter unconditionally? Because you cannot change O_

Re: [Qemu-devel] Safely reopening image files by stashing fds

2011-08-05 Thread Stefan Hajnoczi
On Fri, Aug 5, 2011 at 10:55 AM, Paolo Bonzini wrote: > On 08/05/2011 11:27 AM, Stefan Hajnoczi wrote: First call bdrv_extract_fds() to stash the file descriptors, then close the block device.  Try opening the new image but if that fails, reopen using the stashed file desc

Re: [Qemu-devel] Safely reopening image files by stashing fds

2011-08-05 Thread Daniel P. Berrange
On Fri, Aug 05, 2011 at 10:27:00AM +0100, Stefan Hajnoczi wrote: > On Fri, Aug 5, 2011 at 10:04 AM, Paolo Bonzini wrote: > > 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 close > >> th

Re: [Qemu-devel] Safely reopening image files by stashing fds

2011-08-05 Thread Christoph Hellwig
On Fri, Aug 05, 2011 at 10:27:00AM +0100, Stefan Hajnoczi wrote: > > Why not do the latter unconditionally? > > Because you cannot change O_DIRECT on an open fd :(. This is why > we're going through this pain. You can. What you can't right now is O_SYNC, but we're going to change that.

Re: [Qemu-devel] Safely reopening image files by stashing fds

2011-08-05 Thread Christoph Hellwig
On Fri, Aug 05, 2011 at 02:12:48PM +0100, Daniel P. Berrange wrote: > > 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 us

Re: [Qemu-devel] Safely reopening image files by stashing fds

2011-08-05 Thread Stefan Hajnoczi
On Fri, Aug 5, 2011 at 3:28 PM, Christoph Hellwig wrote: > On Fri, Aug 05, 2011 at 02:12:48PM +0100, Daniel P. Berrange wrote: >> > 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 cu

Re: [Qemu-devel] Safely reopening image files by stashing fds

2011-08-05 Thread Kevin Wolf
Am 05.08.2011 17:24, schrieb Stefan Hajnoczi: > On Fri, Aug 5, 2011 at 3:28 PM, Christoph Hellwig wrote: >> On Fri, Aug 05, 2011 at 02:12:48PM +0100, Daniel P. Berrange wrote: Because you cannot change O_DIRECT on an open fd :(. This is why we're going through this pain. >>> >>> Hmm, I

Re: [Qemu-devel] Safely reopening image files by stashing fds

2011-08-05 Thread Anthony Liguori
On 08/05/2011 10:43 AM, Kevin Wolf wrote: Am 05.08.2011 17:24, schrieb Stefan Hajnoczi: On Fri, Aug 5, 2011 at 3:28 PM, Christoph Hellwig wrote: On Fri, Aug 05, 2011 at 02:12:48PM +0100, Daniel P. Berrange wrote: Because you cannot change O_DIRECT on an open fd :(. This is why we're going th

Re: [Qemu-devel] Safely reopening image files by stashing fds

2011-08-05 Thread Blue Swirl
On Fri, Aug 5, 2011 at 8:40 AM, Stefan Hajnoczi wrote: > We've discussed safe methods for reopening image files (e.g. useful for > changing the hostcache parameter).  The problem is that closing the file first > and then opening it again exposes us to the error case where the open fails. > At that

Re: [Qemu-devel] Safely reopening image files by stashing fds

2011-08-07 Thread Supriya Kannery
On 08/05/2011 09:19 PM, Anthony Liguori wrote: On 08/05/2011 10:43 AM, Kevin Wolf wrote: Am 05.08.2011 17:24, schrieb Stefan Hajnoczi: On Fri, Aug 5, 2011 at 3:28 PM, Christoph Hellwig wrote: On Fri, Aug 05, 2011 at 02:12:48PM +0100, Daniel P. Berrange wrote: Because you cannot change O_DIREC

Re: [Qemu-devel] Safely reopening image files by stashing fds

2011-08-08 Thread Kevin Wolf
Am 08.08.2011 09:02, schrieb Supriya Kannery: > On 08/05/2011 09:19 PM, Anthony Liguori wrote: >> On 08/05/2011 10:43 AM, Kevin Wolf wrote: >>> Am 05.08.2011 17:24, schrieb Stefan Hajnoczi: On Fri, Aug 5, 2011 at 3:28 PM, Christoph Hellwig wrote: > On Fri, Aug 05, 2011 at 02:12:48PM +0100,

Re: [Qemu-devel] Safely reopening image files by stashing fds

2011-08-08 Thread Stefan Hajnoczi
On Fri, Aug 5, 2011 at 10:48 AM, Kevin Wolf wrote: > Am 05.08.2011 11:29, schrieb Stefan Hajnoczi: >> On Fri, Aug 5, 2011 at 10:07 AM, Kevin Wolf wrote: >>> Am 05.08.2011 10:40, schrieb Stefan Hajnoczi: We've discussed safe methods for reopening image files (e.g. useful for changing the

Re: [Qemu-devel] Safely reopening image files by stashing fds

2011-08-08 Thread Kevin Wolf
Am 08.08.2011 16:49, schrieb Stefan Hajnoczi: > On Fri, Aug 5, 2011 at 10:48 AM, Kevin Wolf wrote: >> Am 05.08.2011 11:29, schrieb Stefan Hajnoczi: >>> On Fri, Aug 5, 2011 at 10:07 AM, Kevin Wolf wrote: Am 05.08.2011 10:40, schrieb Stefan Hajnoczi: > We've discussed safe methods for reop

Re: [Qemu-devel] Safely reopening image files by stashing fds

2011-08-09 Thread supriya kannery
Kevin Wolf wrote: Am 08.08.2011 09:02, schrieb Supriya Kannery: On 08/05/2011 09:19 PM, Anthony Liguori wrote: On 08/05/2011 10:43 AM, Kevin Wolf wrote: Am 05.08.2011 17:24, schrieb Stefan Hajnoczi: On Fri, Aug 5, 2011 at 3:28 PM, Christoph Hellwig wrote: O

Re: [Qemu-devel] Safely reopening image files by stashing fds

2011-08-09 Thread Kevin Wolf
Am 09.08.2011 11:22, schrieb supriya kannery: > Kevin Wolf wrote: >> Am 08.08.2011 09:02, schrieb Supriya Kannery: >> >>> On 08/05/2011 09:19 PM, Anthony Liguori wrote: >>> On 08/05/2011 10:43 AM, Kevin Wolf wrote: > Am 05.08.2011 17:24, schrieb Stefan Hajnoczi: >

Re: [Qemu-devel] Safely reopening image files by stashing fds

2011-08-09 Thread supriya kannery
Kevin Wolf wrote: Am 09.08.2011 11:22, schrieb supriya kannery: Kevin Wolf wrote: Am 08.08.2011 09:02, schrieb Supriya Kannery: On 08/05/2011 09:19 PM, Anthony Liguori wrote: On 08/05/2011 10:43 AM, Kevin Wolf wrote: Am 05.08.2011 17:24, schr

Re: [Qemu-devel] Safely reopening image files by stashing fds

2011-08-09 Thread Stefan Hajnoczi
On Tue, Aug 9, 2011 at 11:35 AM, Kevin Wolf wrote: > Am 09.08.2011 12:25, schrieb Stefan Hajnoczi: >> On Mon, Aug 8, 2011 at 4:16 PM, Kevin Wolf wrote: >>> Am 08.08.2011 16:49, schrieb Stefan Hajnoczi: On Fri, Aug 5, 2011 at 10:48 AM, Kevin Wolf wrote: > Am 05.08.2011 11:29, schrieb Ste

Re: [Qemu-devel] Safely reopening image files by stashing fds

2011-08-09 Thread Stefan Hajnoczi
On Tue, Aug 9, 2011 at 11:50 AM, Stefan Hajnoczi wrote: > On Tue, Aug 9, 2011 at 11:35 AM, Kevin Wolf wrote: >> Am 09.08.2011 12:25, schrieb Stefan Hajnoczi: >>> On Mon, Aug 8, 2011 at 4:16 PM, Kevin Wolf wrote: Am 08.08.2011 16:49, schrieb Stefan Hajnoczi: > On Fri, Aug 5, 2011 at 10:4

Re: [Qemu-devel] Safely reopening image files by stashing fds

2011-08-09 Thread Stefan Hajnoczi
On Tue, Aug 09, 2011 at 01:39:13PM +0200, Kevin Wolf wrote: > Am 09.08.2011 12:56, schrieb Stefan Hajnoczi: > > On Tue, Aug 9, 2011 at 11:50 AM, Stefan Hajnoczi wrote: > >> On Tue, Aug 9, 2011 at 11:35 AM, Kevin Wolf wrote: > >>> Am 09.08.2011 12:25, schrieb Stefan Hajnoczi: > On Mon, Aug 8,

Re: [Qemu-devel] Safely reopening image files by stashing fds

2011-08-09 Thread Kevin Wolf
Am 09.08.2011 12:56, schrieb Stefan Hajnoczi: > On Tue, Aug 9, 2011 at 11:50 AM, Stefan Hajnoczi wrote: >> On Tue, Aug 9, 2011 at 11:35 AM, Kevin Wolf wrote: >>> Am 09.08.2011 12:25, schrieb Stefan Hajnoczi: On Mon, Aug 8, 2011 at 4:16 PM, Kevin Wolf wrote: > Am 08.08.2011 16:49, schrie

Re: [Qemu-devel] Safely reopening image files by stashing fds

2011-08-09 Thread Kevin Wolf
Am 09.08.2011 12:25, schrieb Stefan Hajnoczi: > On Mon, Aug 8, 2011 at 4:16 PM, Kevin Wolf wrote: >> Am 08.08.2011 16:49, schrieb Stefan Hajnoczi: >>> On Fri, Aug 5, 2011 at 10:48 AM, Kevin Wolf wrote: Am 05.08.2011 11:29, schrieb Stefan Hajnoczi: > On Fri, Aug 5, 2011 at 10:07 AM, Kevin

Re: [Qemu-devel] Safely reopening image files by stashing fds

2011-08-09 Thread Stefan Hajnoczi
On Mon, Aug 8, 2011 at 4:16 PM, Kevin Wolf wrote: > Am 08.08.2011 16:49, schrieb Stefan Hajnoczi: >> On Fri, Aug 5, 2011 at 10:48 AM, Kevin Wolf wrote: >>> Am 05.08.2011 11:29, schrieb Stefan Hajnoczi: On Fri, Aug 5, 2011 at 10:07 AM, Kevin Wolf wrote: > Am 05.08.2011 10:40, schrieb Ste

Re: [Qemu-devel] Safely reopening image files by stashing fds

2011-08-09 Thread Kevin Wolf
Am 09.08.2011 14:00, schrieb Stefan Hajnoczi: > On Tue, Aug 09, 2011 at 01:39:13PM +0200, Kevin Wolf wrote: >> Am 09.08.2011 12:56, schrieb Stefan Hajnoczi: >>> On Tue, Aug 9, 2011 at 11:50 AM, Stefan Hajnoczi wrote: On Tue, Aug 9, 2011 at 11:35 AM, Kevin Wolf wrote: > Am 09.08.2011 12:2

Re: [Qemu-devel] Safely reopening image files by stashing fds

2011-08-09 Thread Blue Swirl
On Tue, Aug 9, 2011 at 12:24 PM, Kevin Wolf wrote: > Am 09.08.2011 14:00, schrieb Stefan Hajnoczi: >> On Tue, Aug 09, 2011 at 01:39:13PM +0200, Kevin Wolf wrote: >>> Am 09.08.2011 12:56, schrieb Stefan Hajnoczi: On Tue, Aug 9, 2011 at 11:50 AM, Stefan Hajnoczi wrote: > On Tue, Aug

Re: [Qemu-devel] Safely reopening image files by stashing fds

2011-08-10 Thread Kevin Wolf
Am 09.08.2011 21:39, schrieb Blue Swirl: > On Tue, Aug 9, 2011 at 12:24 PM, Kevin Wolf wrote: >> Am 09.08.2011 14:00, schrieb Stefan Hajnoczi: >>> On Tue, Aug 09, 2011 at 01:39:13PM +0200, Kevin Wolf wrote: Am 09.08.2011 12:56, schrieb Stefan Hajnoczi: > On Tue, Aug 9, 2011 at 11:50 AM, S

Re: [Qemu-devel] Safely reopening image files by stashing fds

2011-08-10 Thread Blue Swirl
On Wed, Aug 10, 2011 at 7:58 AM, Kevin Wolf wrote: > Am 09.08.2011 21:39, schrieb Blue Swirl: >> On Tue, Aug 9, 2011 at 12:24 PM, Kevin Wolf wrote: >>> Am 09.08.2011 14:00, schrieb Stefan Hajnoczi: On Tue, Aug 09, 2011 at 01:39:13PM +0200, Kevin Wolf wrote: > Am 09.08.2011 12:56, schrieb

Re: [Qemu-devel] Safely reopening image files by stashing fds

2011-08-11 Thread Kevin Wolf
Am 10.08.2011 19:20, schrieb Blue Swirl: > On Wed, Aug 10, 2011 at 7:58 AM, Kevin Wolf wrote: >> Am 09.08.2011 21:39, schrieb Blue Swirl: >>> On Tue, Aug 9, 2011 at 12:24 PM, Kevin Wolf wrote: Am 09.08.2011 14:00, schrieb Stefan Hajnoczi: > I liked the idea of doing a generic FDStash typ

Re: [Qemu-devel] Safely reopening image files by stashing fds

2011-08-11 Thread Blue Swirl
On Thu, Aug 11, 2011 at 7:37 AM, Kevin Wolf wrote: > Am 10.08.2011 19:20, schrieb Blue Swirl: >> On Wed, Aug 10, 2011 at 7:58 AM, Kevin Wolf wrote: >>> Am 09.08.2011 21:39, schrieb Blue Swirl: On Tue, Aug 9, 2011 at 12:24 PM, Kevin Wolf wrote: > Am 09.08.2011 14:00, schrieb Stefan Hajno