From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53742) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bDpiH-0005qk-Ae for qemu-devel@nongnu.org; Fri, 17 Jun 2016 05:05:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bDpiF-0000AH-Bq for qemu-devel@nongnu.org; Fri, 17 Jun 2016 05:05:16 -0400 Date: Fri, 17 Jun 2016 11:05:05 +0200 From: Kevin Wolf Message-ID: <20160617090505.GA5431@noname.redhat.com> References: <1464943756-14143-1-git-send-email-famz@redhat.com> <1464943756-14143-2-git-send-email-famz@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1464943756-14143-2-git-send-email-famz@redhat.com> Subject: Re: [Qemu-devel] [PATCH v6 01/22] block: Add flag bits for image locking List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Fam Zheng Cc: qemu-devel@nongnu.org, Max Reitz , Jeff Cody , Markus Armbruster , Eric Blake , qemu-block@nongnu.org, rjones@redhat.com, stefanha@redhat.com, pbonzini@redhat.com, John Snow , berrange@redhat.com, den@openvz.org Am 03.06.2016 um 10:48 hat Fam Zheng geschrieben: > 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 > Reviewed-by: Max Reitz Worth asserting in bdrv_open_common() that BDRV_O_NO_LOCK and BDRV_O_SHARED_LOCK aren't passed at the same time? Kevin > include/block/block.h | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/include/block/block.h b/include/block/block.h > index 70ea299..02b598b 100644 > --- a/include/block/block.h > +++ b/include/block/block.h > @@ -94,6 +94,8 @@ 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_CACHE_MASK (BDRV_O_NOCACHE | BDRV_O_NO_FLUSH) > > -- > 2.8.2 >