]> git.proxmox.com Git - mirror_qemu.git/commit
file-posix: Add image locking to perm operations
authorFam Zheng <famz@redhat.com>
Tue, 2 May 2017 16:35:56 +0000 (00:35 +0800)
committerKevin Wolf <kwolf@redhat.com>
Thu, 11 May 2017 09:15:32 +0000 (11:15 +0200)
commit244a5668106297378391b768e7288eb157616f64
treeac1272b206e9ba0090ca882a5471b5c2768cbd1b
parente8c1094a0ee081f30ec9716593e7a90ee88623a1
file-posix: Add image locking to perm operations

This extends the permission bits of op blocker API to external using
Linux OFD locks.

Each permission in @perm and @shared_perm is represented by a locked
byte in the image file.  Requesting a permission in @perm is translated
to a shared lock of the corresponding byte; rejecting to share the same
permission is translated to a shared lock of a separate byte. With that,
we use 2x number of bytes of distinct permission types.

virtlockd in libvirt locks the first byte, so we do locking from a
higher offset.

Suggested-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
block/file-posix.c