]> git.ipfire.org Git - thirdparty/qemu.git/commit
vhost: restore avail index from vring used index on disconnection
authorMaxime Coquelin <maxime.coquelin@redhat.com>
Thu, 16 Nov 2017 18:48:35 +0000 (19:48 +0100)
committerMichael Roth <mdroth@linux.vnet.ibm.com>
Wed, 6 Dec 2017 15:55:22 +0000 (09:55 -0600)
commit0bc76c8d0899f1f3a2bc5092ae9de7a900213a3b
tree83108a85fe2dcdf04908ed4ff66103794d46c182
parent059422ddbc9e3b7fbe54a6d87b9ac0b329bb16b9
vhost: restore avail index from vring used index on disconnection

vhost_virtqueue_stop() gets avail index value from the backend,
except if the backend is not responding.

It happens when the backend crashes, and in this case, internal
state of the virtio queue is inconsistent, making packets
to corrupt the vring state.

With a Linux guest, it results in following error message on
backend reconnection:

[   22.444905] virtio_net virtio0: output.0:id 0 is not a head!
[   22.446746] net enp0s3: Unexpected TXQ (0) queue failure: -5
[   22.476360] net enp0s3: Unexpected TXQ (0) queue failure: -5

Fixes: 283e2c2adcb8 ("net: virtio-net discards TX data after link down")
Cc: qemu-stable@nongnu.org
Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
(cherry picked from commit 2ae39a113af311cb56a0c35b7f212dafcef15303)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
hw/virtio/vhost.c