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

Hu Tao hutao at cn.fujitsu.com
Fri Mar 25 07:06:16 UTC 2011


On Thu, Mar 24, 2011 at 04:22:38PM -0700, Josh Durgin wrote:
> On 03/24/2011 02:45 PM, Eric Blake wrote:
> > 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?)
> 
> This won't work for network disks, which aren't files. To check
> for network disk conflicts, you'd need to check that whether any
> host and port are the same as well. This won't be perfect, since
> hosts and ports can be implicit or referred to by different
> names, but it won't have false positives.

Is there a perfect way to solve this problem? However I will try your
way first.




More information about the libvir-list mailing list