[libvirt] [PATCHv2] Don't allow two or more disks to be mapped to the same image file

Eric Blake eblake at redhat.com
Thu Mar 24 21:45:26 UTC 2011


On 03/24/2011 02:46 AM, Hu Tao wrote:
> If two or more disks are mapped to the same image file, operating
> on these disks at the same time may corrupt data stored in the
> image file.
> 
> changes:
> 
> v2:
> 
> - allow it for read-only disks
> - compare source files by inode number
> 
> +
> +    if (stat(disk->src, &stat1)) {
> +        if (errno != ENOENT) {
> +            /* Can't stat file, for safety treate it as conflicted */

s/treate/treat/

Won't this will fail on root-squash NFS from qemu:///system?  (Or does
root-squash meant that root can still stat() but just not open() a file?)

Overall, I'm worried that this patch is repeating some of danpb's bigger
efforts to integrate a sanlock disk contention avoidance [1].  If a
resource manager is properly hooked to all disks, then we can prevent
contention between domains (and not limit ourself to just single-domain
contention, as in this patch).  On the other hand, this seems like an
easy enough check to do for a single domain whether or not we get the
sanlock code completed (that is, timing wise this looks like it could be
ready prior to 0.9.0 while Dan's work is bigger in scope and probably
missed the feature freeze for this month's release).  So I'm not sure
whether to ack this.

[1] https://www.redhat.com/archives/libvir-list/2011-January/msg00963.html

-- 
Eric Blake   eblake at redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 619 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20110324/6b92824e/attachment-0001.sig>


More information about the libvir-list mailing list