* [Qemu-devel] [PATCH] 9pfs: fix multiple flush for same request
@ 2017-03-30 8:26 Greg Kurz
2017-03-30 13:18 ` [Qemu-devel] [PATCH for-2.9?] " Eric Blake
0 siblings, 1 reply; 3+ messages in thread
From: Greg Kurz @ 2017-03-30 8:26 UTC (permalink / raw)
To: qemu-devel; +Cc: Li Qiang, 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>
---
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);
}
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [Qemu-devel] [PATCH for-2.9?] 9pfs: fix multiple flush for same request
2017-03-30 8:26 [Qemu-devel] [PATCH] 9pfs: fix multiple flush for same request Greg Kurz
@ 2017-03-30 13:18 ` Eric Blake
2017-03-30 15:07 ` Greg Kurz
0 siblings, 1 reply; 3+ messages in thread
From: Eric Blake @ 2017-03-30 13:18 UTC (permalink / raw)
To: Greg Kurz, qemu-devel; +Cc: Li Qiang
[-- Attachment #1: Type: text/plain, Size: 1421 bytes --]
On 03/30/2017 03:26 AM, Greg Kurz wrote:
> 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.
Since this fixes a hang, is it 2.9 material?
>
> 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>
> ---
> hw/9pfs/9p.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
Reviewed-by: Eric Blake <eblake@redhat.com>
> 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);
> }
>
>
>
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [Qemu-devel] [PATCH for-2.9?] 9pfs: fix multiple flush for same request
2017-03-30 13:18 ` [Qemu-devel] [PATCH for-2.9?] " Eric Blake
@ 2017-03-30 15:07 ` Greg Kurz
0 siblings, 0 replies; 3+ messages in thread
From: Greg Kurz @ 2017-03-30 15:07 UTC (permalink / raw)
To: Eric Blake; +Cc: qemu-devel, Li Qiang
[-- Attachment #1: Type: text/plain, Size: 1541 bytes --]
On Thu, 30 Mar 2017 08:18:34 -0500
Eric Blake <eblake@redhat.com> wrote:
> On 03/30/2017 03:26 AM, Greg Kurz wrote:
> > 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.
>
> Since this fixes a hang, is it 2.9 material?
>
Yes, definitely, I just forgot to add the for-2.9 tag :)
> >
> > 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>
> > ---
> > hw/9pfs/9p.c | 6 ++++--
> > 1 file changed, 4 insertions(+), 2 deletions(-)
> >
>
> Reviewed-by: Eric Blake <eblake@redhat.com>
>
> > 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);
> > }
> >
> >
> >
>
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-03-30 15:07 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-30 8:26 [Qemu-devel] [PATCH] 9pfs: fix multiple flush for same request Greg Kurz
2017-03-30 13:18 ` [Qemu-devel] [PATCH for-2.9?] " Eric Blake
2017-03-30 15:07 ` Greg Kurz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).