All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PULL 0/2] 9pfs fixes for 2.9 2017-04-04
@ 2017-04-04 16:13 Greg Kurz
  2017-04-04 16:13 ` [Qemu-devel] [PULL 1/2] 9pfs: fix multiple flush for same request Greg Kurz
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Greg Kurz @ 2017-04-04 16:13 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, 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.

----------------------------------------------------------------
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(-)
-- 
2.7.4

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Qemu-devel] [PULL 1/2] 9pfs: fix multiple flush for same request
  2017-04-04 16:13 [Qemu-devel] [PULL 0/2] 9pfs fixes for 2.9 2017-04-04 Greg Kurz
@ 2017-04-04 16:13 ` Greg Kurz
  2017-04-04 16:13 ` [Qemu-devel] [PULL 2/2] 9pfs: clear migration blocker at session reset Greg Kurz
  2017-04-04 17:33 ` [Qemu-devel] [PULL 0/2] 9pfs fixes for 2.9 2017-04-04 Peter Maydell
  2 siblings, 0 replies; 4+ messages in thread
From: Greg Kurz @ 2017-04-04 16:13 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, Greg Kurz

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.

Signed-off-by: Greg Kurz <groug@kaod.org>
Reviewed-by: Eric Blake <eblake@redhat.com>
---
 hw/9pfs/9p.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/hw/9pfs/9p.c b/hw/9pfs/9p.c
index 48babce836b6..ef47a0a5ad6f 100644
--- a/hw/9pfs/9p.c
+++ b/hw/9pfs/9p.c
@@ -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);
 }
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [Qemu-devel] [PULL 2/2] 9pfs: clear migration blocker at session reset
  2017-04-04 16:13 [Qemu-devel] [PULL 0/2] 9pfs fixes for 2.9 2017-04-04 Greg Kurz
  2017-04-04 16:13 ` [Qemu-devel] [PULL 1/2] 9pfs: fix multiple flush for same request Greg Kurz
@ 2017-04-04 16:13 ` Greg Kurz
  2017-04-04 17:33 ` [Qemu-devel] [PULL 0/2] 9pfs fixes for 2.9 2017-04-04 Peter Maydell
  2 siblings, 0 replies; 4+ messages in thread
From: Greg Kurz @ 2017-04-04 16:13 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, 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.

Signed-off-by: Greg Kurz <groug@kaod.org>
Reviewed-by: Li Qiang <liqiang6-s@360.cn>
---
 hw/9pfs/9p.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/hw/9pfs/9p.c b/hw/9pfs/9p.c
index ef47a0a5ad6f..c80ba67389ce 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);
     }
 }
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PULL 0/2] 9pfs fixes for 2.9 2017-04-04
  2017-04-04 16:13 [Qemu-devel] [PULL 0/2] 9pfs fixes for 2.9 2017-04-04 Greg Kurz
  2017-04-04 16:13 ` [Qemu-devel] [PULL 1/2] 9pfs: fix multiple flush for same request Greg Kurz
  2017-04-04 16:13 ` [Qemu-devel] [PULL 2/2] 9pfs: clear migration blocker at session reset Greg Kurz
@ 2017-04-04 17:33 ` Peter Maydell
  2 siblings, 0 replies; 4+ messages in thread
From: Peter Maydell @ 2017-04-04 17:33 UTC (permalink / raw)
  To: Greg Kurz; +Cc: QEMU Developers

On 4 April 2017 at 17:13, Greg Kurz <groug@kaod.org> wrote:
> 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(-)

Applied, thanks.

-- PMM

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-04-04 17:33 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-04 16:13 [Qemu-devel] [PULL 0/2] 9pfs fixes for 2.9 2017-04-04 Greg Kurz
2017-04-04 16:13 ` [Qemu-devel] [PULL 1/2] 9pfs: fix multiple flush for same request Greg Kurz
2017-04-04 16:13 ` [Qemu-devel] [PULL 2/2] 9pfs: clear migration blocker at session reset Greg Kurz
2017-04-04 17:33 ` [Qemu-devel] [PULL 0/2] 9pfs fixes for 2.9 2017-04-04 Peter Maydell

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.