From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 78D5A1F1C; Mon, 29 Oct 2018 06:29:40 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 28 Oct 2018 22:29:39 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,438,1534834800"; d="scan'208";a="276436905" Received: from btwcube1.sh.intel.com ([10.67.104.158]) by fmsmga006.fm.intel.com with ESMTP; 28 Oct 2018 22:29:38 -0700 From: Tiwei Bie To: maxime.coquelin@redhat.com, zhihong.wang@intel.com, dev@dpdk.org Cc: stephen@networkplumber.org, stable@dpdk.org Date: Mon, 29 Oct 2018 13:28:03 +0800 Message-Id: <20181029052808.16520-2-tiwei.bie@intel.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181029052808.16520-1-tiwei.bie@intel.com> References: <20181029052808.16520-1-tiwei.bie@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH 1/6] net/virtio-user: do not stop stopped device again X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Oct 2018 05:29:41 -0000 Without this change, virtio-user still works, but it will show annoying error messages like this on shutdown: vhost_kernel_set_backend(): VHOST_NET_SET_BACKEND fails, Operation not permitted vhost_kernel_ioctl(): VHOST_RESET_OWNER failed: Operation not permitted Fixes: e3b434818bbb ("net/virtio-user: support kernel vhost") Fixes: 12ecb2f63b12 ("net/virtio-user: support memory hotplug") Cc: stable@dpdk.org Reported-by: Stephen Hemminger Signed-off-by: Tiwei Bie --- drivers/net/virtio/virtio_user/virtio_user_dev.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/net/virtio/virtio_user/virtio_user_dev.c b/drivers/net/virtio/virtio_user/virtio_user_dev.c index a185aed34..684702c56 100644 --- a/drivers/net/virtio/virtio_user/virtio_user_dev.c +++ b/drivers/net/virtio/virtio_user/virtio_user_dev.c @@ -184,6 +184,9 @@ int virtio_user_stop_device(struct virtio_user_dev *dev) uint32_t i; pthread_mutex_lock(&dev->mutex); + if (!dev->started) + goto out; + for (i = 0; i < dev->max_queue_pairs; ++i) dev->ops->enable_qp(dev, i, 0); @@ -193,6 +196,7 @@ int virtio_user_stop_device(struct virtio_user_dev *dev) return -1; } dev->started = false; +out: pthread_mutex_unlock(&dev->mutex); return 0; -- 2.19.1