diff mbox

[v6,14/22] mirror: Disable image locking on target backing chain

Message ID 1464943756-14143-15-git-send-email-famz@redhat.com
State New
Headers show

Commit Message

Fam Zheng June 3, 2016, 8:49 a.m. UTC
In sync=none the backing image of s->target is s->common.bs, which could
be exclusively locked, the image locking wouldn't work here.

Later we can update completion code to lock it after the replaced node
has dropped its lock.

Signed-off-by: Fam Zheng <famz@redhat.com>
---
 blockdev.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

Comments

Max Reitz June 6, 2016, 3:03 p.m. UTC | #1
On 03.06.2016 10:49, Fam Zheng wrote:
> In sync=none the backing image of s->target is s->common.bs, which could
> be exclusively locked, the image locking wouldn't work here.
> 
> Later we can update completion code to lock it after the replaced node
> has dropped its lock.
> 
> Signed-off-by: Fam Zheng <famz@redhat.com>
> ---
>  blockdev.c | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)

Without having reviewed the patch in the new context, when basing your
series on v2 of my "block/mirror: Fix target backing BDS​", all iotests
pass even without this patch.

Without my series, test 041 fails.

So I have reason to hope that I was actually able to make this patch
superfluous.

Max
Fam Zheng June 8, 2016, 3:22 a.m. UTC | #2
On Mon, 06/06 17:03, Max Reitz wrote:
> On 03.06.2016 10:49, Fam Zheng wrote:
> > In sync=none the backing image of s->target is s->common.bs, which could
> > be exclusively locked, the image locking wouldn't work here.
> > 
> > Later we can update completion code to lock it after the replaced node
> > has dropped its lock.
> > 
> > Signed-off-by: Fam Zheng <famz@redhat.com>
> > ---
> >  blockdev.c | 10 ++++++++--
> >  1 file changed, 8 insertions(+), 2 deletions(-)
> 
> Without having reviewed the patch in the new context, when basing your
> series on v2 of my "block/mirror: Fix target backing BDS​", all iotests
> pass even without this patch.
> 
> Without my series, test 041 fails.
> 
> So I have reason to hope that I was actually able to make this patch
> superfluous.

Great, then I can drop this patch from v7 later.

Fam
diff mbox

Patch

diff --git a/blockdev.c b/blockdev.c
index fa8b50c..4a9fa7c 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -3620,8 +3620,14 @@  void qmp_drive_mirror(const char *device, const char *target,
     /* Mirroring takes care of copy-on-write using the source's backing
      * file.
      */
-    target_bs = bdrv_open(target, NULL, options, flags | BDRV_O_NO_BACKING,
-                          errp);
+    flags |= BDRV_O_NO_BACKING;
+    if (sync == MIRROR_SYNC_MODE_NONE) {
+        /* TODO: in mirror complete, after target_bs is switched to and the
+         * original BDS's lock is dropped, we should enable the lock on
+         * target_bs.  */
+        flags |= BDRV_O_NO_LOCK;
+    }
+    target_bs = bdrv_open(target, NULL, options, flags, errp);
     if (!target_bs) {
         goto out;
     }