mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 00:03:54 -06:00
migration: disallow migrate_add_blocker during migration
If a migration is already in progress and somebody attempts to add a migration blocker, this should rightly fail. Add an errp parameter and a retcode return value to migrate_add_blocker. Signed-off-by: John Snow <jsnow@redhat.com> Signed-off-by: Ashijeet Acharya <ashijeetacharya@gmail.com> Message-Id: <1484566314-3987-5-git-send-email-ashijeetacharya@gmail.com> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Acked-by: Greg Kurz <groug@kaod.org> Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Merged with recent 'Allow invtsc migration' change
This commit is contained in:
parent
a3a3d8c738
commit
fe44dc9180
18 changed files with 222 additions and 81 deletions
33
hw/9pfs/9p.c
33
hw/9pfs/9p.c
|
@ -979,6 +979,7 @@ static void coroutine_fn v9fs_attach(void *opaque)
|
|||
size_t offset = 7;
|
||||
V9fsQID qid;
|
||||
ssize_t err;
|
||||
Error *local_err = NULL;
|
||||
|
||||
v9fs_string_init(&uname);
|
||||
v9fs_string_init(&aname);
|
||||
|
@ -1007,26 +1008,36 @@ static void coroutine_fn v9fs_attach(void *opaque)
|
|||
clunk_fid(s, fid);
|
||||
goto out;
|
||||
}
|
||||
|
||||
/*
|
||||
* disable migration if we haven't done already.
|
||||
* attach could get called multiple times for the same export.
|
||||
*/
|
||||
if (!s->migration_blocker) {
|
||||
error_setg(&s->migration_blocker,
|
||||
"Migration is disabled when VirtFS export path '%s' is mounted in the guest using mount_tag '%s'",
|
||||
s->ctx.fs_root ? s->ctx.fs_root : "NULL", s->tag);
|
||||
err = migrate_add_blocker(s->migration_blocker, &local_err);
|
||||
if (local_err) {
|
||||
error_free(local_err);
|
||||
error_free(s->migration_blocker);
|
||||
s->migration_blocker = NULL;
|
||||
clunk_fid(s, fid);
|
||||
goto out;
|
||||
}
|
||||
s->root_fid = fid;
|
||||
}
|
||||
|
||||
err = pdu_marshal(pdu, offset, "Q", &qid);
|
||||
if (err < 0) {
|
||||
clunk_fid(s, fid);
|
||||
goto out;
|
||||
}
|
||||
err += offset;
|
||||
|
||||
memcpy(&s->root_qid, &qid, sizeof(qid));
|
||||
trace_v9fs_attach_return(pdu->tag, pdu->id,
|
||||
qid.type, qid.version, qid.path);
|
||||
/*
|
||||
* 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_setg(&s->migration_blocker,
|
||||
"Migration is disabled when VirtFS export path '%s' is mounted in the guest using mount_tag '%s'",
|
||||
s->ctx.fs_root ? s->ctx.fs_root : "NULL", s->tag);
|
||||
migrate_add_blocker(s->migration_blocker);
|
||||
}
|
||||
out:
|
||||
put_fid(pdu, fidp);
|
||||
out_nofid:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue