diff mbox

[for-2.7,v2,01/17] block: Add BDRV_O_NO_LOCK

Message ID 1460690887-32751-2-git-send-email-famz@redhat.com
State New
Headers show

Commit Message

Fam Zheng April 15, 2016, 3:27 a.m. UTC
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_NO_LOCK the flag indicating that the block layer should skip the
automatic locking of the image, like the old behavior.

Signed-off-by: Fam Zheng <famz@redhat.com>
---
 include/block/block.h | 1 +
 1 file changed, 1 insertion(+)

Comments

Denis V. Lunev April 16, 2016, 10:47 a.m. UTC | #1
On 04/15/2016 06:27 AM, Fam Zheng wrote:
> 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_NO_LOCK the flag indicating that the block layer should skip the
> automatic locking of the image, like the old behavior.
>
> Signed-off-by: Fam Zheng <famz@redhat.com>
> ---
>   include/block/block.h | 1 +
>   1 file changed, 1 insertion(+)
>
> diff --git a/include/block/block.h b/include/block/block.h
> index 3a73137..b803597 100644
> --- a/include/block/block.h
> +++ b/include/block/block.h
> @@ -94,6 +94,7 @@ 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_CACHE_MASK  (BDRV_O_NOCACHE | BDRV_O_NO_FLUSH)
>   
Reviewed-by: Denis V. Lunev <den@openvz.org>
diff mbox

Patch

diff --git a/include/block/block.h b/include/block/block.h
index 3a73137..b803597 100644
--- a/include/block/block.h
+++ b/include/block/block.h
@@ -94,6 +94,7 @@  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_CACHE_MASK  (BDRV_O_NOCACHE | BDRV_O_NO_FLUSH)