OSDN Git Service

vhost-user-blk: delay vhost_user_blk_disconnect
authorDima Stepanov <dimastep@yandex-team.ru>
Thu, 28 May 2020 09:11:19 +0000 (12:11 +0300)
committerMichael S. Tsirkin <mst@redhat.com>
Tue, 9 Jun 2020 18:18:04 +0000 (14:18 -0400)
commit4bcad76f4c390f798198a9a93fbaa1a20d06b73e
tree301dbda624ee6b8e1f81091c0b3ce54f1395391e
parent271094474b65de1ad7aaf729938de3d9b9d0d36f
vhost-user-blk: delay vhost_user_blk_disconnect

A socket write during vhost-user communication may trigger a disconnect
event, calling vhost_user_blk_disconnect() and clearing all the
vhost_dev structures holding data that vhost-user functions expect to
remain valid to roll back initialization correctly. Delay the cleanup to
keep vhost_dev structure valid.
There are two possible states to handle:
1. RUN_STATE_PRELAUNCH: skip bh oneshot call and perform disconnect in
the caller routine.
2. RUN_STATE_RUNNING: delay by using bh

BH changes are based on the similar changes for the vhost-user-net
device:
  commit e7c83a885f865128ae3cf1946f8cb538b63cbfba
  "vhost-user: delay vhost_user_stop"

Signed-off-by: Dima Stepanov <dimastep@yandex-team.ru>
Message-Id: <69b73b94dcd066065595266c852810e0863a0895.1590396396.git.dimastep@yandex-team.ru>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Li Feng <fengli@smartx.com>
Reviewed-by: Raphael Norwitz <raphael.norwitz@nutanix.com>
hw/block/vhost-user-blk.c