9pfs: clear migration blocker at session reset

The migration blocker survives a device reset: if the guest mounts a 9p
share and then gets rebooted with system_reset, it will be unmigratable
until it remounts and umounts the 9p share again.

This happens because the migration blocker is supposed to be cleared when
we put the last reference on the root fid, but virtfs_reset() wrongly calls
free_fid() instead of put_fid().

This patch fixes virtfs_reset() so that it honor the way fids are supposed
to be manipulated: first get a reference and later put it back when you're
done.

Signed-off-by: Greg Kurz <groug@kaod.org>
Reviewed-by: Li Qiang <liqiang6-s@360.cn>
This commit is contained in:
Greg Kurz 2017-04-04 18:06:01 +02:00
parent 18adde86dd
commit 6d54af0ea9
1 changed files with 7 additions and 6 deletions

View File

@ -539,14 +539,15 @@ static void coroutine_fn virtfs_reset(V9fsPDU *pdu)
/* Free all fids */
while (s->fid_list) {
/* Get fid */
fidp = s->fid_list;
s->fid_list = fidp->next;
fidp->ref++;
if (fidp->ref) {
fidp->clunked = 1;
} else {
free_fid(pdu, fidp);
}
/* Clunk fid */
s->fid_list = fidp->next;
fidp->clunked = 1;
put_fid(pdu, fidp);
}
}