aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--hw/9pfs/9p.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/hw/9pfs/9p.c b/hw/9pfs/9p.c
index 48babce836..c80ba67389 100644
--- a/hw/9pfs/9p.c
+++ b/hw/9pfs/9p.c
@@ -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;
+ fidp->ref++;
+
+ /* Clunk fid */
s->fid_list = fidp->next;
+ fidp->clunked = 1;
- if (fidp->ref) {
- fidp->clunked = 1;
- } else {
- free_fid(pdu, fidp);
- }
+ put_fid(pdu, fidp);
}
}
@@ -2387,8 +2388,10 @@ static void coroutine_fn v9fs_flush(void *opaque)
* Wait for pdu to complete.
*/
qemu_co_queue_wait(&cancel_pdu->complete, NULL);
- cancel_pdu->cancelled = 0;
- pdu_free(cancel_pdu);
+ if (!qemu_co_queue_next(&cancel_pdu->complete)) {
+ cancel_pdu->cancelled = 0;
+ pdu_free(cancel_pdu);
+ }
}
pdu_complete(pdu, 7);
}