Commit 18adde86 authored by Greg Kurz's avatar Greg Kurz
Browse files

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.

Signed-off-by: default avatarGreg Kurz <groug@kaod.org>
Reviewed-by: default avatarEric Blake <eblake@redhat.com>
parent 87cc4c61
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -2387,9 +2387,11 @@ static void coroutine_fn v9fs_flush(void *opaque)
         * Wait for pdu to complete.
         */
        qemu_co_queue_wait(&cancel_pdu->complete, NULL);
        if (!qemu_co_queue_next(&cancel_pdu->complete)) {
            cancel_pdu->cancelled = 0;
            pdu_free(cancel_pdu);
        }
    }
    pdu_complete(pdu, 7);
}