[dpdk-dev,v2,3/3] vhost: don't take access_lock on VHOST_USER_RESET_OWNER

Message ID 20180212154612.5297-4-maxime.coquelin@redhat.com
State Accepted, archived
Headers show

Checks

Context Check Description
ci/Intel-compilation success Compilation OK
ci/checkpatch success coding style OK

Commit Message

Maxime Coquelin Feb. 12, 2018, 3:46 p.m.
A deadlock happens when handling VHOST_USER_RESET_OWNER request
for the same reason the lock is not taken for
VHOST_USER_GET_VRING_BASE.

It is safe not to take the lock, as the queues are no more used
by the application when the virtqueues and the device are reset.

Fixes: a3688046995f ("vhost: protect active rings from async ring changes")
Cc: stable@dpdk.org

Cc: Victor Kaplansky <victork@redhat.com>
Reviewed-by: Tiwei Bie <tiwei.bie@intel.com>
Reviewed-by: Jianfeng Tan <jianfeng.tan@intel.com>
Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
---
 lib/librte_vhost/vhost_user.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

Patch

diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c
index 65ee33919..90ed2112e 100644
--- a/lib/librte_vhost/vhost_user.c
+++ b/lib/librte_vhost/vhost_user.c
@@ -1348,16 +1348,16 @@  vhost_user_msg_handler(int vid, int fd)
 	}
 
 	/*
-	 * Note: we don't lock all queues on VHOST_USER_GET_VRING_BASE,
-	 * since it is sent when virtio stops and device is destroyed.
-	 * destroy_device waits for queues to be inactive, so it is safe.
-	 * Otherwise taking the access_lock would cause a dead lock.
+	 * Note: we don't lock all queues on VHOST_USER_GET_VRING_BASE
+	 * and VHOST_USER_RESET_OWNER, since it is sent when virtio stops
+	 * and device is destroyed. destroy_device waits for queues to be
+	 * inactive, so it is safe. Otherwise taking the access_lock
+	 * would cause a dead lock.
 	 */
 	switch (msg.request.master) {
 	case VHOST_USER_SET_FEATURES:
 	case VHOST_USER_SET_PROTOCOL_FEATURES:
 	case VHOST_USER_SET_OWNER:
-	case VHOST_USER_RESET_OWNER:
 	case VHOST_USER_SET_MEM_TABLE:
 	case VHOST_USER_SET_LOG_BASE:
 	case VHOST_USER_SET_LOG_FD: