2023-11-19 20:57:53

by Arseniy Krasnov

[permalink] [raw]
Subject: [RFC PATCH v2 1/3] vsock: update SO_RCVLOWAT setting callback

Do not return if transport callback for SO_RCVLOWAT is set (only in
error case). In this case we don't need to set 'sk_rcvlowat' field in
each transport - only in 'vsock_set_rcvlowat()'.

Signed-off-by: Arseniy Krasnov <[email protected]>
---
net/vmw_vsock/af_vsock.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/net/vmw_vsock/af_vsock.c b/net/vmw_vsock/af_vsock.c
index 816725af281f..af0058037f72 100644
--- a/net/vmw_vsock/af_vsock.c
+++ b/net/vmw_vsock/af_vsock.c
@@ -2264,8 +2264,13 @@ static int vsock_set_rcvlowat(struct sock *sk, int val)

transport = vsk->transport;

- if (transport && transport->set_rcvlowat)
- return transport->set_rcvlowat(vsk, val);
+ if (transport && transport->set_rcvlowat) {
+ int err;
+
+ err = transport->set_rcvlowat(vsk, val);
+ if (err)
+ return err;
+ }

WRITE_ONCE(sk->sk_rcvlowat, val ? : 1);
return 0;
--
2.25.1