Skip to contentSkip to conversation

hw/9pfs: Fix assert when disabling migration

PATCH New Aneesh Kumar K.V 1 participant 1 message Jul 31, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hw/9pfs: Fix assert when disabling migration

From: "Aneesh Kumar K.V" <[email protected]>

For 9p we can get the attach request multiple times for the same export. So don't adding migration blocker for every attach request.

---
 hw/9pfs/virtio-9p.c |   15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)
hw/9pfs/virtio-9p.c +10 -5
index f4a7026..4b52540 100644
@@ -983,11 +983,16 @@ static void v9fs_attach(void *opaque)
     err += offset;
     trace_v9fs_attach_return(pdu->tag, pdu->id,
                              qid.type, qid.version, qid.path);
-    s->root_fid = fid;
-    /* disable migration */
-    error_set(&s->migration_blocker, QERR_VIRTFS_FEATURE_BLOCKS_MIGRATION,
-              s->ctx.fs_root ? s->ctx.fs_root : "NULL", s->tag);
-    migrate_add_blocker(s->migration_blocker);
+    /*
+     * disable migration if we haven't done already.
+     * attach could get called multiple times for the same export.
+     */
+    if (!s->migration_blocker) {
+        s->root_fid = fid;
+        error_set(&s->migration_blocker, QERR_VIRTFS_FEATURE_BLOCKS_MIGRATION,
+                  s->ctx.fs_root ? s->ctx.fs_root : "NULL", s->tag);
+        migrate_add_blocker(s->migration_blocker);
+    }
 out:
     put_fid(pdu, fidp);
 out_nofid:
Signature · 1 line
1.7.10