Skip to contentSkip to conversation

9pfs fixes for 2.9 2017-04-04

GIT PULL Applied Greg Kurz 2 participants 4 messages Apr 4, 2017

lore
Share & tools
lore

Greg Kurz

author
#0 lore raw

The following changes since commit 87cc4c61020addea6a001b94b662596b1896d1b3:

Merge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into staging (2017-04-04 11:40:55 +0100)

are available in the git repository at:

https://github.com/gkurz/qemu.git tags/for-upstream

for you to fetch changes up to 6d54af0ea9eeee70b4c0eb48bd2ae1d22b207dd4:

9pfs: clear migration blocker at session reset (2017-04-04 18:06:01 +0200)

----------------------------------------------------------------
Some 9pfs bugs fixes: potential hang at reset, migration blocker leak.

----------------------------------------------------------------
Greg Kurz (2):
9pfs: fix multiple flush for same request 9pfs: clear migration blocker at session reset

 hw/9pfs/9p.c | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)
Signature · 1 line
2.7.4
author
#1 lore raw

[Qemu-devel] [PULL 1/2] 9pfs: fix multiple flush for same request

If a client tries to flush the same outstanding request several times, only the first flush completes. Subsequent ones keep waiting for the request completion in v9fs_flush() and, therefore, leak a PDU. This will cause QEMU to hang when draining active PDUs the next time the device is reset.

Let have each flush request wake up the next one if any. The last waiter frees the cancelled PDU.

---
 hw/9pfs/9p.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
hw/9pfs/9p.c +4 -2
index 48babce836b6..ef47a0a5ad6f 100644
@@ -2387,8 +2387,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);
 }
Signature · 1 line
2.7.4
author
#2 lore raw

[Qemu-devel] [PULL 2/2] 9pfs: clear migration blocker at session reset

In reply to Greg Kurz

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.

---
 hw/9pfs/9p.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
hw/9pfs/9p.c +6 -5
index ef47a0a5ad6f..c80ba67389ce 100644
@@ -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);
     }
 }
 
Signature · 1 line
2.7.4
#3 lore raw
In reply to Greg Kurz
Quoted 15 lines · Greg Kurz

The following changes since commit 87cc4c61020addea6a001b94b662596b1896d1b3:

Merge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into staging (2017-04-04 11:40:55 +0100)

are available in the git repository at:

https://github.com/gkurz/qemu.git tags/for-upstream

for you to fetch changes up to 6d54af0ea9eeee70b4c0eb48bd2ae1d22b207dd4:

9pfs: clear migration blocker at session reset (2017-04-04 18:06:01 +0200)

----------------------------------------------------------------
Some 9pfs bugs fixes: potential hang at reset, migration blocker leak.

Quoted 7 lines

----------------------------------------------------------------
Greg Kurz (2):
9pfs: fix multiple flush for same request 9pfs: clear migration blocker at session reset

 hw/9pfs/9p.c | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

Applied, thanks.

-- PMM