Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2767917imj; Mon, 11 Feb 2019 08:10:45 -0800 (PST) X-Google-Smtp-Source: AHgI3IYUelYduaaUT5+73bogkX2RM9nxh+Vk4Aa83iorwLHdS3O3Dm9EEV09iu5MRRQcgJwwcQKv X-Received: by 2002:a63:8f45:: with SMTP id r5mr19126553pgn.222.1549901445700; Mon, 11 Feb 2019 08:10:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549901445; cv=none; d=google.com; s=arc-20160816; b=ibXkJgWUzcJKoL9WrCtzwSFtaVye5eCVC12JK0lXi9UC6Y9XRnulQNDsSHc9K6rI/m 8YXYn6SCNzyAqpZfEZByBpTxSHImmN0cp8AWxt8B8FOGSl8GHof9fZS7L3mCkVATb3WO y+2rsfqFPzexE8AVec80tWV77J0PwkQjR6II84Hq5M8kOlMnv9gsi6BYqVA9SPRD82Pp iJQN/y/Qg6U2kekK2hHXJFO5Ki5E+tG2kHqr0q8FbAMGSDNLIpxi5bg+ho4byhVMMHem 1unHNTGNpQRzZkEPZpKyG3VNqmKMF8JTbKnYoTelPadgw2LS/izbqOE99szfhjTVneBd 62kQ== 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=dObuW/DYzeMIx7dUACUOyl+RKd+V8omO8UckWvlgK/I=; b=gCE9+vDA7XK8Lq7HjpaWiNud/Q5fC4YSw3P8oP8seVbD59rlKYgRP/eBuwM45CZZh/ E0PhsVdP0mX+bGUAoejyGdDYqsCwW2h+jmHrEAtmb7IjzOUIfEnANL+3FVmcIuJFGrBR WSqWqYlx8RVnz3OqlQsN9yviIoQOI3WBQD8nOMle9PAB4Sc12lBHTaqWEoK+5uENqxvr Ne5oZVZ6DBGrXgFuSvM1tB2H+PSD6rH+vTeRvFsuAoz5tP0HHV/W4suazE5MxEmg/Gwk +pFRUue1CfCZlhkigRtdlY5MZ0noGvKvV6JgX/I4nFmgCcVdaxkp5IMJJ6NtXfYKIb4H Zg2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=e+kWcrgv; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 63si10868345pla.65.2019.02.11.08.10.29; Mon, 11 Feb 2019 08:10:45 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=e+kWcrgv; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729801AbfBKQHj (ORCPT + 99 others); Mon, 11 Feb 2019 11:07:39 -0500 Received: from mail.kernel.org ([198.145.29.99]:60160 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727725AbfBKO0W (ORCPT ); Mon, 11 Feb 2019 09:26:22 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (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 00CB220844; Mon, 11 Feb 2019 14:26:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1549895181; bh=A9kXdjsw/xxArv3Cn0Ud9woK5bftu+Q9Eh4LmZLGPDo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=e+kWcrgvlpf/cRCHNK0EzW++uYfnsEdtPUckEGXUgPufotOcC5Q1OqnpCZnmN6yGh l+4ipVvJUEZ2uDJir5Pg1wOVE0yFMBPAfdq/r+hkYP4LY7ngrACXxikEK7WuE7mdSP B5OCH/ZyPGm8cQUZMZaU9aHhfRkJe/LLIYS8E+go= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jon Maloy , Hoang Le , "David S. Miller" , Sasha Levin Subject: [PATCH 4.20 121/352] tipc: fix node keep alive interval calculation Date: Mon, 11 Feb 2019 15:15:48 +0100 Message-Id: <20190211141853.816767877@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190211141846.543045703@linuxfoundation.org> References: <20190211141846.543045703@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore 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 4.20-stable review patch. If anyone has any objections, please let me know. ------------------ [ Upstream commit f5d6c3e5a359c0507800e7ac68d565c21de9b5a1 ] When setting LINK tolerance, node timer interval will be calculated base on the LINK with lowest tolerance. But when calculated, the old node timer interval only updated if current setting value (tolerance/4) less than old ones regardless of number of links as well as links' lowest tolerance value. This caused to two cases missing if tolerance changed as following: Case 1: 1.1/ There is one link (L1) available in the system 1.2/ Set L1's tolerance from 1500ms => lower (i.e 500ms) 1.3/ Then, fallback to default (1500ms) or higher (i.e 2000ms) Expected: node timer interval is 1500/4=375ms after 1.3 Result: node timer interval will not being updated after changing tolerance at 1.3 since its value 1500/4=375ms is not less than 500/4=125ms at 1.2. Case 2: 2.1/ There are two links (L1, L2) available in the system 2.2/ L1 and L2 tolerance value are 2000ms as initial 2.3/ Set L2's tolerance from 2000ms => lower 1500ms 2.4/ Disable link L2 (bring down its bearer) Expected: node timer interval is 2000ms/4=500ms after 2.4 Result: node timer interval will not being updated after disabling L2 since its value 2000ms/4=500ms is still not less than 1500/4=375ms at 2.3 although L2 is already not available in the system. To fix this, we start the node interval calculation by initializing it to a value larger than any conceivable calculated value. This way, the link with the lowest tolerance will always determine the calculated value. Acked-by: Jon Maloy Signed-off-by: Hoang Le Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- net/tipc/node.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/net/tipc/node.c b/net/tipc/node.c index 488019766433..32556f480a60 100644 --- a/net/tipc/node.c +++ b/net/tipc/node.c @@ -624,6 +624,12 @@ static void tipc_node_timeout(struct timer_list *t) __skb_queue_head_init(&xmitq); + /* Initial node interval to value larger (10 seconds), then it will be + * recalculated with link lowest tolerance + */ + tipc_node_read_lock(n); + n->keepalive_intv = 10000; + tipc_node_read_unlock(n); for (bearer_id = 0; remains && (bearer_id < MAX_BEARERS); bearer_id++) { tipc_node_read_lock(n); le = &n->links[bearer_id]; -- 2.19.1