[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v8 01/36] block: Add flag bits for image locking
From: |
Fam Zheng |
Subject: |
[Qemu-devel] [PATCH v8 01/36] block: Add flag bits for image locking |
Date: |
Fri, 30 Sep 2016 20:09:31 +0800 |
Later the block layer will automatically lock the images to avoid unexpected
concurrent accesses to the same image, which will easily corrupt the metadata
or user data, unless in some very special cases, like migration.
The exceptional cases like shared storage migration and testing should
set BDRV_O_SHARED_LOCK or BDRV_O_NO_LOCK to advise an appropriate
locking mode.
Signed-off-by: Fam Zheng <address@hidden>
Reviewed-by: Max Reitz <address@hidden>
---
include/block/block.h | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/include/block/block.h b/include/block/block.h
index e18233a..cecab7a 100644
--- a/include/block/block.h
+++ b/include/block/block.h
@@ -98,7 +98,11 @@ typedef struct HDGeometry {
select an appropriate protocol driver,
ignoring the format layer */
#define BDRV_O_NO_IO 0x10000 /* don't initialize for I/O */
+#define BDRV_O_NO_LOCK 0x20000 /* don't lock image file */
+#define BDRV_O_SHARED_LOCK 0x40000 /* lock the image file in shared mode */
+#define BDRV_O_EXCLUSIVE_LOCK 0x80000 /* lock the image file in exclusive mode
*/
+#define BDRV_O_LOCK_MASK (BDRV_O_NO_LOCK | BDRV_O_SHARED_LOCK |
BDRV_O_EXCLUSIVE_LOCK)
#define BDRV_O_CACHE_MASK (BDRV_O_NOCACHE | BDRV_O_NO_FLUSH)
--
2.7.4
- [Qemu-devel] [PATCH v8 00/36] block: Image locking series, Fam Zheng, 2016/09/30
- [Qemu-devel] [PATCH v8 01/36] block: Add flag bits for image locking,
Fam Zheng <=
- [Qemu-devel] [PATCH v8 02/36] qapi: Add ImageLockMode, Fam Zheng, 2016/09/30
- [Qemu-devel] [PATCH v8 03/36] block: Introduce image file locking, Fam Zheng, 2016/09/30
- [Qemu-devel] [PATCH v8 04/36] osdep: Add qemu_lock_fd and qemu_unlock_fd, Fam Zheng, 2016/09/30
- [Qemu-devel] [PATCH v8 06/36] qemu-io: Add "-L" option for BDRV_O_NO_LOCK, Fam Zheng, 2016/09/30
- [Qemu-devel] [PATCH v8 05/36] raw-posix: Add image locking support, Fam Zheng, 2016/09/30
- [Qemu-devel] [PATCH v8 08/36] qemu-img: Update documentation of "-L" option, Fam Zheng, 2016/09/30
- [Qemu-devel] [PATCH v8 07/36] qemu-img: Add "-L" option to sub commands, Fam Zheng, 2016/09/30
- [Qemu-devel] [PATCH v8 10/36] block: Don't lock drive-backup target image in none mode, Fam Zheng, 2016/09/30
- [Qemu-devel] [PATCH v8 09/36] qemu-nbd: Add "--no-lock/-L" option, Fam Zheng, 2016/09/30
- [Qemu-devel] [PATCH v8 11/36] block: Add blk_lock_image, Fam Zheng, 2016/09/30