Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp4131741pxk; Tue, 8 Sep 2020 11:28:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJydUQXWx4UvcfK1ZSaVRfWz7s32bqyqHiYPu12xHo3QNtO3VDCzT8IGvX05cH816gyQlsji X-Received: by 2002:a17:906:4d97:: with SMTP id s23mr20315017eju.157.1599589692959; Tue, 08 Sep 2020 11:28:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599589692; cv=none; d=google.com; s=arc-20160816; b=SIVtDW3jlXY7PnIGo93hBTCyTOvmKOWkCLrCW8UeVNi7AXPFnTos5is0yfA1efAieI lt5FvwimmpJCyIsLS4VyOpDek+AsVTF8WLwh4i1H1993g74l+hF6SFzfmhN0Hk+wWdlX Xnct62G8Vb5AAdRtcQNEIHDjpfHcDLYtE6K3zwPaHDTkv1ZffDKCUK1YQnml1PlJZqOO 21NHtUhAEiCcNWShMDNNczY+M7KuFu95i6vMNaWqE5EV/9Gi5jsaU7eoe3iQSxGT5abp MJpmMYs8c9F9i7KomAuM0E6/Rmxihx5lVguWro7JgwYsKYFKpkaAC6KDJGetLIIy5Jbm G0kg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=O0OgqQHlstZuzfbpcuBec4U7GYK+kl+g/RyP+qoCVJY=; b=I7qwU9y/vySZix5JLhb5p4IQo0XBvguBv5Ua3qNMOq1MuNJrv0ZCD4yOWsKkwxaP+x Ms+FdngZyPEl5Gahfh4+vgZAYiOWstjxbPN1qz/1mlBlnqBOlCTvpDZrn/3PkXEfEDAx p5mXXLn/4xUPRsaFWIXutfRl/mSeFBbV4CXPVGr4BkeE+naUmaNOoH8kYVSQMrG8s8Ln IJ827USY1gZ96QgOYmx482c/jcUUIsJQtmf9SBowf2Qtzb3U4MqKTAeySBkxf6Aw7nEq /PWCdgirhJqaTObIQ/dtj+jE1ubr/JmSVLE0KI4vDhMgdjbNAILJWA7bQg6xwwlvWMmG vpGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=zF4TvRzD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w1si12612106ejc.440.2020.09.08.11.27.50; Tue, 08 Sep 2020 11:28:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=zF4TvRzD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732245AbgIHSV5 (ORCPT + 99 others); Tue, 8 Sep 2020 14:21:57 -0400 Received: from mail.kernel.org ([198.145.29.99]:56078 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731457AbgIHQLL (ORCPT ); Tue, 8 Sep 2020 12:11:11 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 720F2247F6; Tue, 8 Sep 2020 15:42:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599579772; bh=uB2QOgx5HvuM4Y4IZJTTuR3ftpGuETMv9FN5lvux/fI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zF4TvRzDKg7CJkqXp32r4NxXpGjd0Pnhlz3X5HiMwbOIIP37bZSokNYrYMB9x/vxY m6iGvhpBzHatBYN81rYkeAE+HqAUEoRUjSr5QqX+qL0MzPfl9NwWicKAAtbiry0sTL sBNPwHpn4bshAHBZ/EIM9zoq0rmg5dgTHeunv+uo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, David Howells , Sasha Levin Subject: [PATCH 5.4 028/129] rxrpc: Make rxrpc_kernel_get_srtt() indicate validity Date: Tue, 8 Sep 2020 17:24:29 +0200 Message-Id: <20200908152231.095042252@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200908152229.689878733@linuxfoundation.org> References: <20200908152229.689878733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: David Howells [ Upstream commit 1d4adfaf65746203861c72d9d78de349eb97d528 ] Fix rxrpc_kernel_get_srtt() to indicate the validity of the returned smoothed RTT. If we haven't had any valid samples yet, the SRTT isn't useful. Fixes: c410bf01933e ("rxrpc: Fix the excessive initial retransmission timeout") Signed-off-by: David Howells Signed-off-by: Sasha Levin --- fs/afs/fs_probe.c | 4 ++-- fs/afs/vl_probe.c | 4 ++-- include/net/af_rxrpc.h | 2 +- net/rxrpc/peer_object.c | 16 +++++++++++++--- 4 files changed, 18 insertions(+), 8 deletions(-) diff --git a/fs/afs/fs_probe.c b/fs/afs/fs_probe.c index 02e976ca5732f..51ee3dd79700f 100644 --- a/fs/afs/fs_probe.c +++ b/fs/afs/fs_probe.c @@ -92,8 +92,8 @@ responded: } } - rtt_us = rxrpc_kernel_get_srtt(call->net->socket, call->rxcall); - if (rtt_us < server->probe.rtt) { + if (rxrpc_kernel_get_srtt(call->net->socket, call->rxcall, &rtt_us) && + rtt_us < server->probe.rtt) { server->probe.rtt = rtt_us; alist->preferred = index; have_result = true; diff --git a/fs/afs/vl_probe.c b/fs/afs/vl_probe.c index e3aa013c21779..081b7e5b13f58 100644 --- a/fs/afs/vl_probe.c +++ b/fs/afs/vl_probe.c @@ -92,8 +92,8 @@ responded: } } - rtt_us = rxrpc_kernel_get_srtt(call->net->socket, call->rxcall); - if (rtt_us < server->probe.rtt) { + if (rxrpc_kernel_get_srtt(call->net->socket, call->rxcall, &rtt_us) && + rtt_us < server->probe.rtt) { server->probe.rtt = rtt_us; alist->preferred = index; have_result = true; diff --git a/include/net/af_rxrpc.h b/include/net/af_rxrpc.h index ab988940bf045..55b980b21f4b4 100644 --- a/include/net/af_rxrpc.h +++ b/include/net/af_rxrpc.h @@ -59,7 +59,7 @@ bool rxrpc_kernel_abort_call(struct socket *, struct rxrpc_call *, void rxrpc_kernel_end_call(struct socket *, struct rxrpc_call *); void rxrpc_kernel_get_peer(struct socket *, struct rxrpc_call *, struct sockaddr_rxrpc *); -u32 rxrpc_kernel_get_srtt(struct socket *, struct rxrpc_call *); +bool rxrpc_kernel_get_srtt(struct socket *, struct rxrpc_call *, u32 *); int rxrpc_kernel_charge_accept(struct socket *, rxrpc_notify_rx_t, rxrpc_user_attach_call_t, unsigned long, gfp_t, unsigned int); diff --git a/net/rxrpc/peer_object.c b/net/rxrpc/peer_object.c index efce27802a74f..e011594adcd13 100644 --- a/net/rxrpc/peer_object.c +++ b/net/rxrpc/peer_object.c @@ -500,11 +500,21 @@ EXPORT_SYMBOL(rxrpc_kernel_get_peer); * rxrpc_kernel_get_srtt - Get a call's peer smoothed RTT * @sock: The socket on which the call is in progress. * @call: The call to query + * @_srtt: Where to store the SRTT value. * - * Get the call's peer smoothed RTT. + * Get the call's peer smoothed RTT in uS. */ -u32 rxrpc_kernel_get_srtt(struct socket *sock, struct rxrpc_call *call) +bool rxrpc_kernel_get_srtt(struct socket *sock, struct rxrpc_call *call, + u32 *_srtt) { - return call->peer->srtt_us >> 3; + struct rxrpc_peer *peer = call->peer; + + if (peer->rtt_count == 0) { + *_srtt = 1000000; /* 1S */ + return false; + } + + *_srtt = call->peer->srtt_us >> 3; + return true; } EXPORT_SYMBOL(rxrpc_kernel_get_srtt); -- 2.25.1