[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH for-2.7 v2 05/17] raw-posix: Implement .bdrv_loc
From: |
Richard W.M. Jones |
Subject: |
Re: [Qemu-devel] [PATCH for-2.7 v2 05/17] raw-posix: Implement .bdrv_lockf |
Date: |
Sun, 17 Apr 2016 20:27:25 +0100 |
User-agent: |
Mutt/1.5.20 (2009-12-10) |
On Fri, Apr 15, 2016 at 11:27:55AM +0800, Fam Zheng wrote:
> virtlockd in libvirt locks the first byte, we lock byte 1 to avoid
> the intervene.
> +static int raw_lockf(BlockDriverState *bs, BdrvLockfCmd cmd)
> +{
> +
> + BDRVRawState *s = bs->opaque;
> + int ret;
> + struct flock fl = (struct flock) {
> + .l_whence = SEEK_SET,
> + /* Locking byte 1 avoids interfereing with virtlockd. */
> + .l_start = 1,
> + .l_len = 1,
> + };
> +
> + switch (cmd) {
> + case BDRV_LOCKF_RWLOCK:
> + fl.l_type = F_WRLCK;
> + break;
> + case BDRV_LOCKF_ROLOCK:
> + fl.l_type = F_RDLCK;
> + break;
> + case BDRV_LOCKF_UNLOCK:
> + fl.l_type = F_UNLCK;
> + break;
My understanding is this prevents libguestfs from working on live disk
images -- we want to be able to read live disk images (using a
writable overlay and the real disk image as a read-only backing file).
So please don't do this; or suggest how we can ignore the lock for
backing files.
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-df lists disk usage of guests without needing to install any
software inside the virtual machine. Supports Linux and Windows.
http://people.redhat.com/~rjones/virt-df/
- Re: [Qemu-devel] [PATCH for-2.7 v2 04/17] block: Introduce image file locking, (continued)
[Qemu-devel] [PATCH for-2.7 v2 05/17] raw-posix: Implement .bdrv_lockf, Fam Zheng, 2016/04/14
Re: [Qemu-devel] [PATCH for-2.7 v2 05/17] raw-posix: Implement .bdrv_lockf,
Richard W.M. Jones <=
- Re: [Qemu-devel] [PATCH for-2.7 v2 05/17] raw-posix: Implement .bdrv_lockf, Fam Zheng, 2016/04/17
- Re: [Qemu-devel] [PATCH for-2.7 v2 05/17] raw-posix: Implement .bdrv_lockf, Richard W.M. Jones, 2016/04/18
- Re: [Qemu-devel] [PATCH for-2.7 v2 05/17] raw-posix: Implement .bdrv_lockf, Fam Zheng, 2016/04/19
- Re: [Qemu-devel] [PATCH for-2.7 v2 05/17] raw-posix: Implement .bdrv_lockf, Richard W.M. Jones, 2016/04/19
- Re: [Qemu-devel] [PATCH for-2.7 v2 05/17] raw-posix: Implement .bdrv_lockf, Fam Zheng, 2016/04/19
- Re: [Qemu-devel] [PATCH for-2.7 v2 05/17] raw-posix: Implement .bdrv_lockf, Richard W.M. Jones, 2016/04/19
- Re: [Qemu-devel] [PATCH for-2.7 v2 05/17] raw-posix: Implement .bdrv_lockf, Daniel P. Berrange, 2016/04/19
Re: [Qemu-devel] [PATCH for-2.7 v2 05/17] raw-posix: Implement .bdrv_lockf, Daniel P. Berrange, 2016/04/19
Re: [Qemu-devel] [PATCH for-2.7 v2 05/17] raw-posix: Implement .bdrv_lockf, Richard W.M. Jones, 2016/04/19
[Qemu-devel] [PATCH for-2.7 v2 06/17] gluster: Implement .bdrv_lockf, Fam Zheng, 2016/04/14