On Fri, Aug 5, 2011 at 10:04 AM, Paolo Bonzini <pbonz...@redhat.com> 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 >> the >> stashed file descriptors. > > 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. The only method I've found that works is to open("/proc/self/fd/X", new_flags) but that's non-portable. Stefan