[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 13/14] raw-posix: Implement image locking
From: |
Richard W.M. Jones |
Subject: |
Re: [Qemu-devel] [PATCH 13/14] raw-posix: Implement image locking |
Date: |
Mon, 31 Oct 2016 22:39:33 +0000 |
User-agent: |
Mutt/1.5.20 (2009-12-10) |
On Mon, Oct 31, 2016 at 05:01:44PM -0500, Eric Blake wrote:
> On 10/31/2016 10:38 AM, Fam Zheng wrote:
> > This implements open flag sensible image locking for local file
> > and host device protocol.
> >
> > virtlockd in libvirt locks the first byte, so we start looking at the
> > file bytes from 1.
>
> What happens if we try to use a raw file with less than 3 bytes? There's
> not much to be locked in that case (especially if we round down to
> sector sizes - the file is effectively empty) - but it's probably a
> corner case you have to be aware of.
It would be nice if qemu could handle zero-length or even < 512 byte
drives, but we (libguestfs) gave up that battle a long time ago after
encountering several bugs in this area. These days when you try to
add an empty file[1] through the libguestfs API, the implementation
replaces it with a 4096 byte raw-format file of zeroes.
More here:
https://github.com/libguestfs/libguestfs/blob/master/src/drives.c#L395
Rich.
[1] It has the name "/dev/null" for historical reasons, but is not
that actual device for the reasons given above.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
Fedora Windows cross-compiler. Compile Windows programs, test, and
build Windows installers. Over 100 libraries supported.
http://fedoraproject.org/wiki/MinGW
- [Qemu-devel] [PATCH 06/14] block: Set "share-rw" flag for incoming migration, (continued)
- [Qemu-devel] [PATCH 06/14] block: Set "share-rw" flag for incoming migration, Fam Zheng, 2016/10/31
- [Qemu-devel] [PATCH 07/14] iotests: 055: Don't attach the drive to vm for drive-backup, Fam Zheng, 2016/10/31
- [Qemu-devel] [PATCH 08/14] iotests: 030: Read-only open image for getting map, Fam Zheng, 2016/10/31
- [Qemu-devel] [PATCH 09/14] iotests: 087: Don't attch test image twice, Fam Zheng, 2016/10/31
- [Qemu-devel] [PATCH 10/14] iotests: 085: Avoid image locking conflict, Fam Zheng, 2016/10/31
- [Qemu-devel] [PATCH 11/14] iotests: 091: Quit QEMU before checking image, Fam Zheng, 2016/10/31
- [Qemu-devel] [PATCH 12/14] tests: Use null-co:// instead of /dev/null as the dummy image, Fam Zheng, 2016/10/31
- [Qemu-devel] [PATCH 14/14] tests: Add test-image-lock, Fam Zheng, 2016/10/31
- [Qemu-devel] [PATCH 13/14] raw-posix: Implement image locking, Fam Zheng, 2016/10/31