From patchwork Fri Aug 19 05:33:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arseniy Krasnov X-Patchwork-Id: 12948333 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DB063C28B2B for ; Fri, 19 Aug 2022 05:34:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346464AbiHSFe3 (ORCPT ); Fri, 19 Aug 2022 01:34:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56168 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345646AbiHSFe0 (ORCPT ); Fri, 19 Aug 2022 01:34:26 -0400 Received: from mail.sberdevices.ru (mail.sberdevices.ru [45.89.227.171]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 35FB1E115F; Thu, 18 Aug 2022 22:34:15 -0700 (PDT) Received: from s-lin-edge02.sberdevices.ru (localhost [127.0.0.1]) by mail.sberdevices.ru (Postfix) with ESMTP id 667605FD07; Fri, 19 Aug 2022 08:34:13 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sberdevices.ru; s=mail; t=1660887253; bh=oAbKHrPUMqucBfyHil78hHVDn5WAShR1TtVtIynYbkY=; h=From:To:Subject:Date:Message-ID:Content-Type:MIME-Version; b=kRO4SK6kY7hQ5vRkMd70+6712roNzQ4s7XvA/TFvNI8O2+sP7oRfUxHVx8QZZ8gn1 r8LGBMzePfCAh8YQUdOV4CsGEd/ilXtgNCgjuoJRqE3qVzX3mxDjeHkPoW3kPgKkUL upcr3MPuiswzUJrmGHgOV68TuX7pW+HL808SUUo5fKF9XJuPthv4IYZsPpibufMX3Y 0EeFPx2JXChw5sQ/Bn0j1gvKyhZTDIMldkgleNPqMaMs9vl0hS5RZOADu620dpDKf5 IpKEmT5nIPxyWmsBeDm7/8NdYGolRwfGV3Fg3u8A8l1W/HYbFNdxXEJnxkV2dpGK32 7s2Oy5elwcVjw== Received: from S-MS-EXCH02.sberdevices.ru (S-MS-EXCH02.sberdevices.ru [172.16.1.5]) by mail.sberdevices.ru (Postfix) with ESMTP; Fri, 19 Aug 2022 08:34:12 +0300 (MSK) From: Arseniy Krasnov To: Stefano Garzarella , "David S. Miller" , "edumazet@google.com" , "Jakub Kicinski" , Paolo Abeni , "kys@microsoft.com" , "haiyangz@microsoft.com" , "sthemmin@microsoft.com" , "wei.liu@kernel.org" , Dexuan Cui , Stefan Hajnoczi , Bryan Tan , Vishnu Dasa , Krasnov Arseniy , "Michael S. Tsirkin" CC: "virtualization@lists.linux-foundation.org" , "netdev@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linux-hyperv@vger.kernel.org" , "kvm@vger.kernel.org" , kernel , VMware PV-Drivers Reviewers Subject: [PATCH net-next v4 5/9] vsock: pass sock_rcvlowat to notify_poll_in as target Thread-Topic: [PATCH net-next v4 5/9] vsock: pass sock_rcvlowat to notify_poll_in as target Thread-Index: AQHYs41Ba2I9J1kMc0GcNZuEs3vtJA== Date: Fri, 19 Aug 2022 05:33:47 +0000 Message-ID: <90aebdb6-aece-d78c-8393-ec187ebf238f@sberdevices.ru> In-Reply-To: Accept-Language: en-US, ru-RU Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [172.16.1.12] Content-ID: MIME-Version: 1.0 X-KSMG-Rule-ID: 4 X-KSMG-Message-Action: clean X-KSMG-AntiSpam-Status: not scanned, disabled by settings X-KSMG-AntiSpam-Interceptor-Info: not scanned X-KSMG-AntiPhishing: not scanned, disabled by settings X-KSMG-AntiVirus: Kaspersky Secure Mail Gateway, version 1.1.2.30, bases: 2022/08/19 00:26:00 #20118704 X-KSMG-AntiVirus-Status: Clean, skipped Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Passing 1 as the target to notify_poll_in(), we don't honor what the user has set via SO_RCVLOWAT, going to set POLLIN and POLLRDNORM, even if we don't have the amount of bytes expected by the user. Let's use sock_rcvlowat() to get the right target to pass to notify_poll_in(); Signed-off-by: Arseniy Krasnov Reviewed-by: Stefano Garzarella --- net/vmw_vsock/af_vsock.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/net/vmw_vsock/af_vsock.c b/net/vmw_vsock/af_vsock.c index 0a6777526c73..b5cbc849844b 100644 --- a/net/vmw_vsock/af_vsock.c +++ b/net/vmw_vsock/af_vsock.c @@ -1066,8 +1066,9 @@ static __poll_t vsock_poll(struct file *file, struct socket *sock, if (transport && transport->stream_is_active(vsk) && !(sk->sk_shutdown & RCV_SHUTDOWN)) { bool data_ready_now = false; + int target = sock_rcvlowat(sk, 0, INT_MAX); int ret = transport->notify_poll_in( - vsk, 1, &data_ready_now); + vsk, target, &data_ready_now); if (ret < 0) { mask |= EPOLLERR; } else {