Am 01.02.2012 23:41, schrieb Eric Blake: > On 01/31/2012 08:05 PM, Supriya Kannery wrote: >> For changing host pagecache setting of a running VM, it is >> important to have a safe way of reopening its image file. >> >> Following patchset introduces: >> * a generic way to reopen image files safely. >> In this approach, before reopening an image, for each >> block driver, its state will be stashed. Incase preparation >> (bdrv_reopen_prepare) for reopening returns success, the stashed >> state will be cleared (bdrv_reopen_commit) and reopened state will >> be used further. Incase preparation of reopening returns failure, >> the state of the driver will be rolled back (bdrv_reopen_abort) >> to the stashed state. >> This approach is extended to raw-posix, raw-win32 and vmdk block >> drivers in this patchset. Once this is reviewed and finalised, I will >> extend the implementation to other drivers like qcow2, qed etc.. > > How will this interplay with the goal of passing images in by fd rather > than by name? I'd really like to start thinking about how we plan on > coordinating situations where an fd has to be reopened in order to > switch flags (such as O_RDONLY becoming O_RDWR, or adding or subtracting > O_DIRECT), but where SELinux or other isolation means that the > management app (such as libvirt) has to do the open and pass the fd via > 'getfd' monitor command.
That's easy: Either your host OS allows to change the respective flag using fcntl(), which I believe is true for O_DIRECT/O_DSYNC and recent Linux kernels, or you're out of luck. Is there any reason for switching between rw/ro other than modifying the backing file chain (i.e. creating or deleting a snapshot)? Kevin