Blame SOURCES/kvm-docs-Add-image-locking-subsection.patch

4a2fec
From c83bac681bd10d576c3af9a45b49065aa6b7330e Mon Sep 17 00:00:00 2001
4a2fec
From: Fam Zheng <famz@redhat.com>
4a2fec
Date: Thu, 30 Nov 2017 09:25:42 +0100
4a2fec
Subject: [PATCH 05/36] docs: Add image locking subsection
4a2fec
4a2fec
RH-Author: Fam Zheng <famz@redhat.com>
4a2fec
Message-id: <20171130092544.19231-4-famz@redhat.com>
4a2fec
Patchwork-id: 78016
4a2fec
O-Subject: [RHV7.5 qemu-kvm-ma PATCH 3/5] docs: Add image locking subsection
4a2fec
Bugzilla: 1494210
4a2fec
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
4a2fec
RH-Acked-by: Jeffrey Cody <jcody@redhat.com>
4a2fec
RH-Acked-by: John Snow <jsnow@redhat.com>
4a2fec
4a2fec
This documents the image locking feature and explains when and how
4a2fec
related options can be used.
4a2fec
4a2fec
Signed-off-by: Fam Zheng <famz@redhat.com>
4a2fec
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
4a2fec
(cherry picked from commit b1d1cb272882dd6868740155120f6aeb260a204c)
4a2fec
Signed-off-by: Fam Zheng <famz@redhat.com>
4a2fec
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
4a2fec
---
4a2fec
 docs/qemu-block-drivers.texi | 36 ++++++++++++++++++++++++++++++++++++
4a2fec
 qemu-doc.texi                |  1 +
4a2fec
 2 files changed, 37 insertions(+)
4a2fec
4a2fec
diff --git a/docs/qemu-block-drivers.texi b/docs/qemu-block-drivers.texi
4a2fec
index d3b8f3b..aa64e60 100644
4a2fec
--- a/docs/qemu-block-drivers.texi
4a2fec
+++ b/docs/qemu-block-drivers.texi
4a2fec
@@ -785,6 +785,42 @@ warning: ssh server @code{ssh.example.com:22} does not support fsync
4a2fec
 With sufficiently new versions of libssh2 and OpenSSH, @code{fsync} is
4a2fec
 supported.
4a2fec
 
4a2fec
+@node disk_image_locking
4a2fec
+@subsection Disk image file locking
4a2fec
+
4a2fec
+By default, QEMU tries to protect image files from unexpected concurrent
4a2fec
+access, as long as it's supported by the block protocol driver and host
4a2fec
+operating system. If multiple QEMU processes (including QEMU emulators and
4a2fec
+utilities) try to open the same image with conflicting accessing modes, all but
4a2fec
+the first one will get an error.
4a2fec
+
4a2fec
+This feature is currently supported by the file protocol on Linux with the Open
4a2fec
+File Descriptor (OFD) locking API, and can be configured to fall back to POSIX
4a2fec
+locking if the POSIX host doesn't support Linux OFD locking.
4a2fec
+
4a2fec
+To explicitly enable image locking, specify "locking=on" in the file protocol
4a2fec
+driver options. If OFD locking is not possible, a warning will be printed and
4a2fec
+the POSIX locking API will be used. In this case there is a risk that the lock
4a2fec
+will get silently lost when doing hot plugging and block jobs, due to the
4a2fec
+shortcomings of the POSIX locking API.
4a2fec
+
4a2fec
+QEMU transparently handles lock handover during shared storage migration.  For
4a2fec
+shared virtual disk images between multiple VMs, the "share-rw" device option
4a2fec
+should be used.
4a2fec
+
4a2fec
+Alternatively, locking can be fully disabled by "locking=off" block device
4a2fec
+option. In the command line, the option is usually in the form of
4a2fec
+"file.locking=off" as the protocol driver is normally placed as a "file" child
4a2fec
+under a format driver. For example:
4a2fec
+
4a2fec
+@code{-blockdev driver=qcow2,file.filename=/path/to/image,file.locking=off,file.driver=file}
4a2fec
+
4a2fec
+To check if image locking is active, check the output of the "lslocks" command
4a2fec
+on host and see if there are locks held by the QEMU process on the image file.
4a2fec
+More than one byte could be locked by the QEMU instance, each byte of which
4a2fec
+reflects a particular permission that is acquired or protected by the running
4a2fec
+block driver.
4a2fec
+
4a2fec
 @c man end
4a2fec
 
4a2fec
 @ignore
4a2fec
diff --git a/qemu-doc.texi b/qemu-doc.texi
4a2fec
index b0db386..6af38de 100644
4a2fec
--- a/qemu-doc.texi
4a2fec
+++ b/qemu-doc.texi
4a2fec
@@ -405,6 +405,7 @@ encrypted disk images.
4a2fec
 * disk_images_iscsi::         iSCSI LUNs
4a2fec
 * disk_images_gluster::       GlusterFS disk images
4a2fec
 * disk_images_ssh::           Secure Shell (ssh) disk images
4a2fec
+* disk_image_locking::        Disk image file locking
4a2fec
 @end menu
4a2fec
 
4a2fec
 @node disk_images_quickstart
4a2fec
-- 
4a2fec
1.8.3.1
4a2fec