[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

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



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.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]