[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-block] [PATCH v4 08/27] osdep: Add qemu_lock_fd and qemu_unloc
From: |
Richard W.M. Jones |
Subject: |
Re: [Qemu-block] [PATCH v4 08/27] osdep: Add qemu_lock_fd and qemu_unlock_fd |
Date: |
Tue, 10 May 2016 10:06:35 +0100 |
User-agent: |
Mutt/1.5.20 (2009-12-10) |
On Tue, May 10, 2016 at 09:57:48AM +0100, Daniel P. Berrange wrote:
> On Tue, May 10, 2016 at 10:50:40AM +0800, Fam Zheng wrote:
> > They are wrappers of POSIX fcntl file locking, with the additional
> > interception of open/close (through qemu_open and qemu_close) to offer a
> > better semantics that preserves the locks across multiple life cycles of
> > different fds on the same file. The reason to make this semantics
> > change over the fcntl locks is to make the API cleaner for QEMU
> > subsystems.
> >
> > More precisely, we remove this "feature" of fcntl lock:
> >
> > If a process closes any file descriptor referring to a file, then
> > all of the process's locks on that file are released, regardless of
> > the file descriptor(s) on which the locks were obtained.
> >
> > as long as the fd is always open/closed through qemu_open and
> > qemu_close.
>
> You're not actually really removing that problem - this is just hacking
> around it in a manner which is racy & susceptible to silent failure.
Whatever happened to file-private locks (https://lwn.net/Articles/586904/)?
My very recent glibc doesn't appear to include them, unless the
final standard used something different from `F_SETLKPW'.
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-top is 'top' for virtual machines. Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://people.redhat.com/~rjones/virt-top
- [Qemu-block] [PATCH v4 01/27] block: Add BDRV_O_NO_LOCK, (continued)
- [Qemu-block] [PATCH v4 01/27] block: Add BDRV_O_NO_LOCK, Fam Zheng, 2016/05/09
- [Qemu-block] [PATCH v4 02/27] qapi: Add lock-image in blockdev-add options, Fam Zheng, 2016/05/09
- [Qemu-block] [PATCH v4 03/27] blockdev: Add and parse "lock-image" option for block devices, Fam Zheng, 2016/05/09
- [Qemu-block] [PATCH v4 04/27] block: Introduce image file locking, Fam Zheng, 2016/05/09
- [Qemu-block] [PATCH v4 05/27] block: Add bdrv_image_locked, Fam Zheng, 2016/05/09
- [Qemu-block] [PATCH v4 06/27] block: Make bdrv_reopen_{commit, abort} private functions, Fam Zheng, 2016/05/09
- [Qemu-block] [PATCH v4 07/27] block: Handle image locking during reopen, Fam Zheng, 2016/05/09
- [Qemu-block] [PATCH v4 08/27] osdep: Add qemu_lock_fd and qemu_unlock_fd, Fam Zheng, 2016/05/09
- Re: [Qemu-block] [PATCH v4 08/27] osdep: Add qemu_lock_fd and qemu_unlock_fd, Richard W.M. Jones, 2016/05/10
- Re: [Qemu-block] [PATCH v4 08/27] osdep: Add qemu_lock_fd and qemu_unlock_fd, Daniel P. Berrange, 2016/05/10
- Re: [Qemu-block] [Qemu-devel] [PATCH v4 08/27] osdep: Add qemu_lock_fd and qemu_unlock_fd, Fam Zheng, 2016/05/10
- Re: [Qemu-block] [Qemu-devel] [PATCH v4 08/27] osdep: Add qemu_lock_fd and qemu_unlock_fd, Fam Zheng, 2016/05/10
- Re: [Qemu-block] [Qemu-devel] [PATCH v4 08/27] osdep: Add qemu_lock_fd and qemu_unlock_fd, Daniel P. Berrange, 2016/05/11
[Qemu-block] [PATCH v4 09/27] osdep: Introduce qemu_dup, Fam Zheng, 2016/05/09
[Qemu-block] [PATCH v4 10/27] raw-posix: Use qemu_dup, Fam Zheng, 2016/05/09
[Qemu-block] [PATCH v4 11/27] raw-posix: Implement .bdrv_lockf, Fam Zheng, 2016/05/09
[Qemu-block] [PATCH v4 13/27] qemu-io: Add "-L" option for BDRV_O_NO_LOCK, Fam Zheng, 2016/05/09
[Qemu-block] [PATCH v4 12/27] gluster: Implement .bdrv_lockf, Fam Zheng, 2016/05/09
[Qemu-block] [PATCH v4 15/27] qemu-img: Update documentation of "-L" option, Fam Zheng, 2016/05/09