Message ID | 20201016030909.9522-1-lulu@redhat.com |
---|---|
State | Superseded |
Headers | show |
Series | [v2,1/2] vhost-vdpa: Add qemu_close in vhost_vdpa_cleanup | expand |
On 2020/10/16 上午11:09, Cindy Lu wrote: > fix the bug that fd will still open after the cleanup > > Signed-off-by: Cindy Lu <lulu@redhat.com> > --- > net/vhost-vdpa.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c > index bc0e0d2d35..0480b92102 100644 > --- a/net/vhost-vdpa.c > +++ b/net/vhost-vdpa.c > @@ -144,6 +144,10 @@ static void vhost_vdpa_cleanup(NetClientState *nc) > g_free(s->vhost_net); > s->vhost_net = NULL; > } > + if (s->vhost_vdpa.device_fd >= 0) { > + qemu_close(s->vhost_vdpa.device_fd); > + s->vhost_vdpa.device_fd = -1; > + } > } > > static bool vhost_vdpa_has_vnet_hdr(NetClientState *nc) Acked-by: Jason Wang <jasowang@redhat.com>
On 2020/10/16 上午11:09, Cindy Lu wrote: > Fix the bug that while Check qemu supported netdev, > there is no vhost-vdpa > > Signed-off-by: Cindy Lu <lulu@redhat.com> > --- > net/net.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/net/net.c b/net/net.c > index 7a2a0fb5ac..794c652282 100644 > --- a/net/net.c > +++ b/net/net.c > @@ -1049,6 +1049,9 @@ static void show_netdevs(void) > #endif > #ifdef CONFIG_POSIX > "vhost-user", > +#endif > +#ifdef CONFIG_VHOST_VDPA > + "vhost-vdpa", > #endif > }; Acked-by: Jason Wang <jasowang@redhat.com> >
diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c index bc0e0d2d35..0480b92102 100644 --- a/net/vhost-vdpa.c +++ b/net/vhost-vdpa.c @@ -144,6 +144,10 @@ static void vhost_vdpa_cleanup(NetClientState *nc) g_free(s->vhost_net); s->vhost_net = NULL; } + if (s->vhost_vdpa.device_fd >= 0) { + qemu_close(s->vhost_vdpa.device_fd); + s->vhost_vdpa.device_fd = -1; + } } static bool vhost_vdpa_has_vnet_hdr(NetClientState *nc)
fix the bug that fd will still open after the cleanup Signed-off-by: Cindy Lu <lulu@redhat.com> --- net/vhost-vdpa.c | 4 ++++ 1 file changed, 4 insertions(+)