[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200907105220.27776-3-lingshan.zhu@intel.com>
Date: Mon, 7 Sep 2020 18:52:20 +0800
From: Zhu Lingshan <lingshan.zhu@...el.com>
To: jasowang@...hat.com, mst@...hat.com
Cc: virtualization@...ts.linux-foundation.org, netdev@...r.kernel.org,
kvm@...r.kernel.org, Zhu Lingshan <lingshan.zhu@...el.com>
Subject: [PATCH 2/2] vhost_net: introduce vhost_net_set_backend_features()
This commit introduced a new function
vhost_net_set_backend_features() which is a wrap of
vhost_set_backend_features() with necessary mutex lockings.
Signed-off-by: Zhu Lingshan <lingshan.zhu@...el.com>
---
drivers/vhost/net.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c
index 531a00d703cd..e01da77538c8 100644
--- a/drivers/vhost/net.c
+++ b/drivers/vhost/net.c
@@ -1679,6 +1679,13 @@ static long vhost_net_set_owner(struct vhost_net *n)
return r;
}
+static void vhost_net_set_backend_features(struct vhost_dev *dev, u64 features)
+{
+ mutex_lock(&dev->mutex);
+ vhost_set_backend_features(dev, features);
+ mutex_unlock(&dev->mutex);
+}
+
static long vhost_net_ioctl(struct file *f, unsigned int ioctl,
unsigned long arg)
{
@@ -1715,7 +1722,7 @@ static long vhost_net_ioctl(struct file *f, unsigned int ioctl,
return -EFAULT;
if (features & ~VHOST_NET_BACKEND_FEATURES)
return -EOPNOTSUPP;
- vhost_set_backend_features(&n->dev, features);
+ vhost_net_set_backend_features(&n->dev, features);
return 0;
case VHOST_RESET_OWNER:
return vhost_net_reset_owner(n);
--
2.18.4
Powered by blists - more mailing lists