vhost: fix stored last used index
authorBalazs Nemeth <bnemeth@redhat.com>
Fri, 14 May 2021 16:02:07 +0000 (18:02 +0200)
committerChenbo Xia <chenbo.xia@intel.com>
Tue, 18 May 2021 07:43:35 +0000 (09:43 +0200)
commit3ad55b8e94caa33c55895600865fe7edf7cc8d53
tree6a0f48ea0927474fb30330e5ab9188fff17f5704
parentec962bad14e143ac6853a0acbae13755f450f646
vhost: fix stored last used index

The optimization introduced by
commit d18db8049c7c ("vhost: read last used index once")
didn't account for the fact that vhost_flush_enqueue_shadow_packed
increments the last_used_idx.
For this reason, store last_used_idx after the potential call to
vhost_flush_enqueue_shadow_packed.

Bugzilla ID: 699
Fixes: d18db8049c7c ("vhost: read last used index once")

Signed-off-by: Balazs Nemeth <bnemeth@redhat.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Tested-by: Wei Ling <weix.ling@intel.com>
lib/vhost/virtio_net.c