[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] One more thing about block device locking
From: |
Richard W.M. Jones |
Subject: |
Re: [Qemu-devel] One more thing about block device locking |
Date: |
Fri, 23 Apr 2010 09:00:25 +0100 |
User-agent: |
Mutt/1.5.18 (2008-05-17) |
On Fri, Apr 23, 2010 at 09:07:28AM +0400, Michael Tokarev wrote:
> So we'll have to either
> trial and error, or open "normally", check
> if it's a block device and re-open with that
> flag set.
Perhaps I'm missing something, but why can't you stat(2) the name
first to see if it's a block device (ie. S_ISBLK(st_mode)) then add
the O_EXCL flag or not as appropriate?
Anyway, the problem with this is it's not helpful (in fact: actively
bad) for libguestfs. We want to allow people to open existing devices
read-only, even if one qemu process has them open for writing.
Consider, for example, virt-df or virt-cat which allow you to read
information out from live VMs.
This is why we should have exclusive|shared modes for locking (or if
you prefer write|read -- it's the same thing with a different name
AFAICT).
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
virt-p2v converts physical machines to virtual machines. Boot with a
live CD or over the network (PXE) and turn machines into Xen guests.
http://et.redhat.com/~rjones/virt-p2v