Skip to contentSkip to conversation

vhost-user: release chardev on cleanup

RFC PATCH New [email protected] 1 participant 3 messages Sep 3, 2015 Networking

lore
Share & tools
lore
#0 lore raw

cover vhost-user: release chardev on cleanup

From: Marc-André Lureau <[email protected]>

The following 2 one-liners remove the chardev from the vhost-user netdev it is attached to. This prevents from further reuse of the chardev that would likely fail to setup again with the backend depending on their state.

Related to:
https://bugzilla.redhat.com/show_bug.cgi?id=1256619
https://bugzilla.redhat.com/show_bug.cgi?id=1256618

Marc-André Lureau (2):
vhost-user: release chardev on cleanup
vhost-user: delete chardev on cleanup

 net/vhost-user.c | 3 +++
 1 file changed, 3 insertions(+)
Signature · 1 line
2.4.3
#1 lore raw

RFC PATCH 1/2 vhost-user: release chardev on cleanup

From: Marc-André Lureau <[email protected]>

On init, vhost-user does qemu_chr_fe_claim_no_fail(). Do the opposite on cleanup to allow removing or reusing the chardev.

---
 net/vhost-user.c | 2 ++
 1 file changed, 2 insertions(+)
net/vhost-user.c +2 -0
index 93dcecd..01df925 100644
@@ -71,6 +71,8 @@ static void vhost_user_cleanup(NetClientState *nc)
 
     vhost_user_stop(s);
     qemu_purge_queued_packets(nc);
+
+    qemu_chr_fe_release(s->chr);
 }
 
 static bool vhost_user_has_vnet_hdr(NetClientState *nc)
Signature · 1 line
2.4.3
#2 lore raw

RFC PATCH 2/2 vhost-user: delete chardev on cleanup

In reply to [email protected]

From: Marc-André Lureau <[email protected]>

Remove the chardev implicitely when cleaning up the netdev. This prevents from reusing the chardev since it would be in an incorrect state for the server.

---
 net/vhost-user.c | 1 +
 1 file changed, 1 insertion(+)
net/vhost-user.c +1 -0
index 01df925..6660cdc 100644
@@ -73,6 +73,7 @@ static void vhost_user_cleanup(NetClientState *nc)
     qemu_purge_queued_packets(nc);
 
     qemu_chr_fe_release(s->chr);
+    qemu_chr_delete(s->chr);
 }
 
 static bool vhost_user_has_vnet_hdr(NetClientState *nc)
Signature · 1 line
2.4.3