Message ID | 20200917155851.20636-2-lulu@redhat.com |
---|---|
State | Superseded |
Headers | show |
Series | [1/3] virtio-net: Set mac address to hardware if the peer is vdpa | expand |
On 2020/9/17 下午11:58, Cindy Lu wrote: > fix the bug that fd will still open after the cleanup > > Signed-off-by: Cindy Lu <lulu@redhat.com> Acked-by: Jason Wang <jasowang@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)
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(+)