Stefano Garzarella
2023-Mar-28 09:39 UTC
[RFC PATCH v1 1/2] vsock: return errors other than -ENOMEM to socket
On Sun, Mar 26, 2023 at 01:13:11AM +0300, Arseniy Krasnov wrote:>This removes behaviour, where error code returned from any transport >was always switched to ENOMEM. This works in the same way as: >commit >c43170b7e157 ("vsock: return errors other than -ENOMEM to socket"), >but for receive calls. > >Signed-off-by: Arseniy Krasnov <AVKrasnov at sberdevices.ru> >--- > net/vmw_vsock/af_vsock.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > >diff --git a/net/vmw_vsock/af_vsock.c b/net/vmw_vsock/af_vsock.c >index 19aea7cba26e..9262e0b77d47 100644 >--- a/net/vmw_vsock/af_vsock.c >+++ b/net/vmw_vsock/af_vsock.c >@@ -2007,7 +2007,7 @@ static int __vsock_stream_recvmsg(struct sock *sk, struct msghdr *msg, > > read = transport->stream_dequeue(vsk, msg, len - copied, flags);In vmci_transport_stream_dequeue() vmci_qpair_peekv() and vmci_qpair_dequev() return VMCI_ERROR_* in case of errors. Maybe we should return -ENOMEM in vmci_transport_stream_dequeue() if those functions fail to keep the same behavior. CCing Bryan, Vishnu, and pv-drivers at vmware.com The other transports seem okay to me. Thanks, Stefano> if (read < 0) { >- err = -ENOMEM; >+ err = read; > break; > } > >@@ -2058,7 +2058,7 @@ static int __vsock_seqpacket_recvmsg(struct sock *sk, struct msghdr *msg, > msg_len = transport->seqpacket_dequeue(vsk, msg, flags); > > if (msg_len < 0) { >- err = -ENOMEM; >+ err = msg_len; > goto out; > } > >-- >2.25.1 >
Stefano Garzarella
2023-Mar-28 09:42 UTC
[RFC PATCH v1 1/2] vsock: return errors other than -ENOMEM to socket
I pressed send too early... CCing Bryan, Vishnu, and pv-drivers at vmware.com On Tue, Mar 28, 2023 at 11:39?AM Stefano Garzarella <sgarzare at redhat.com> wrote:> > On Sun, Mar 26, 2023 at 01:13:11AM +0300, Arseniy Krasnov wrote: > >This removes behaviour, where error code returned from any transport > >was always switched to ENOMEM. This works in the same way as: > >commit > >c43170b7e157 ("vsock: return errors other than -ENOMEM to socket"), > >but for receive calls. > > > >Signed-off-by: Arseniy Krasnov <AVKrasnov at sberdevices.ru> > >--- > > net/vmw_vsock/af_vsock.c | 4 ++-- > > 1 file changed, 2 insertions(+), 2 deletions(-) > > > >diff --git a/net/vmw_vsock/af_vsock.c b/net/vmw_vsock/af_vsock.c > >index 19aea7cba26e..9262e0b77d47 100644 > >--- a/net/vmw_vsock/af_vsock.c > >+++ b/net/vmw_vsock/af_vsock.c > >@@ -2007,7 +2007,7 @@ static int __vsock_stream_recvmsg(struct sock *sk, struct msghdr *msg, > > > > read = transport->stream_dequeue(vsk, msg, len - copied, flags); > > In vmci_transport_stream_dequeue() vmci_qpair_peekv() and > vmci_qpair_dequev() return VMCI_ERROR_* in case of errors. > > Maybe we should return -ENOMEM in vmci_transport_stream_dequeue() if > those functions fail to keep the same behavior. > > CCing Bryan, Vishnu, and pv-drivers at vmware.com > > The other transports seem okay to me. > > Thanks, > Stefano > > > if (read < 0) { > >- err = -ENOMEM; > >+ err = read; > > break; > > } > > > >@@ -2058,7 +2058,7 @@ static int __vsock_seqpacket_recvmsg(struct sock *sk, struct msghdr *msg, > > msg_len = transport->seqpacket_dequeue(vsk, msg, flags); > > > > if (msg_len < 0) { > >- err = -ENOMEM; > >+ err = msg_len; > > goto out; > > } > > > >-- > >2.25.1 > >