* Peter Maydell (peter.mayd...@linaro.org) wrote: > On 20 March 2018 at 03:17, Michael S. Tsirkin <m...@redhat.com> wrote: > > From: "Dr. David Alan Gilbert" <dgilb...@redhat.com> > > > > Register the UFD that comes in as the response to the 'advise' method > > with the postcopy code. > > > > Signed-off-by: Dr. David Alan Gilbert <dgilb...@redhat.com> > > Reviewed-by: Marc-André Lureau <marcandre.lur...@redhat.com> > > Reviewed-by: Michael S. Tsirkin <m...@redhat.com> > > Signed-off-by: Michael S. Tsirkin <m...@redhat.com> > > --- > > hw/virtio/vhost-user.c | 20 +++++++++++++++++++- > > 1 file changed, 19 insertions(+), 1 deletion(-) > > > @@ -835,8 +847,14 @@ static int vhost_user_postcopy_advise(struct vhost_dev > > *dev, Error **errp) > > error_setg(errp, "%s: Failed to get ufd", __func__); > > return -1; > > } > > + fcntl(ufd, F_SETFL, O_NONBLOCK); > > Hi; this would probably be more neatly done with > qemu_set_nonblock(ufd); > unless you really wanted to clear the other fd flags. > Among other things, it avoids Coverity producing a complaint > that we didn't check the fcntl return value (though we seem > to assume it can't fail in general, hence qemu_set_nonblock() > returning NULL.) -- CID1390601, which I've marked as false-positive.
Fix posted. To be honest, I probably hadn't realised/forgot that this would nuke all the other flags. I bet some of the others uses are the same, and may be losing important flags like noexec. Dave > > - /* TODO: register ufd with userfault thread */ > > + /* register ufd with userfault thread */ > > + u->postcopy_fd.fd = ufd; > > + u->postcopy_fd.data = dev; > > + u->postcopy_fd.handler = vhost_user_postcopy_fault_handler; > > + u->postcopy_fd.idstr = "vhost-user"; /* Need to find unique name */ > > + postcopy_register_shared_ufd(&u->postcopy_fd); > > return 0; > > } > > thanks > -- PMM -- Dr. David Alan Gilbert / dgilb...@redhat.com / Manchester, UK