Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3705403imu; Mon, 28 Jan 2019 09:20:32 -0800 (PST) X-Google-Smtp-Source: ALg8bN4JNiTsIenY+tYpqPuI3J64cBZausVQGl62LkTE1WvRiXm49p6lcv/5ErTeMwFLIc+Lji2v X-Received: by 2002:a65:4049:: with SMTP id h9mr20227964pgp.304.1548696032181; Mon, 28 Jan 2019 09:20:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548696032; cv=none; d=google.com; s=arc-20160816; b=lDKvE9Zq7FydbsfD/jNzE5WlsL4Q7O14orRi6DhfqaAY/KgTj3aoEOYpEW3uTuYbnj ya264shCZqMhKW21qPGJJ2jtD0BKOTojuGnUHRD+lwzDVENmxNBnzLyEZOlRtqzxXIzH nhxNO3fstIAHMj1C01MF480m88+5kthd1OBUINSqts5Vx59CggGFbzHBbH1wcz18vGXq plwKP8lstmNFoyqACMDkwSCc+D+j9IQGcBEtkc0WQHsVGgEGwCJognMmLJcPd3F0sWtq 2Y+VYAZdJF1Gd/0xbLhHWkidf69O7R4Y1Xv05qcskYttMU1/Y8s3YwSZN+ZHNSJNTFB5 c7WA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=hmW2b7KWKKJv74d0Xddi0+hTlrqnk5rClRxCVr1op34=; b=TsyHzndIHl8+fxnC/UPFHxVBdx4mpqUH9h6bVdj5R8o5vlYAAEzGYpcQ7TvXkh+Ek5 9MIgLQdcR3w31V79K2/FFZLguHOd/u94GVYR7K3gYJPLI326e6urk+B/CO3YP2mmh5zL z/d7Gq4JY+u6WzyndvwVFZsb0UB/azwXVYI8l+ejGDJbcPYg0empgvy8ysb8R09beBdO kb8uAI2mp1a0Qnp/V7PXk8vPnPG2eoWzPtZUs5Jphuxy9on/t1smcSvvxDgIJ3sZwi1T 3/M+OTzpZkWeNEHsXy9IU5IE/lWK545WhyUZhZDuGO/3LNDc9Wnjv8pzUlyy0x3xnqx0 ddgw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ejAOrdaA; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 82si34295016pfa.115.2019.01.28.09.20.16; Mon, 28 Jan 2019 09:20:32 -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=ejAOrdaA; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731888AbfA1RTc (ORCPT + 99 others); Mon, 28 Jan 2019 12:19:32 -0500 Received: from mail.kernel.org ([198.145.29.99]:50646 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731668AbfA1QEq (ORCPT ); Mon, 28 Jan 2019 11:04:46 -0500 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7FB9E21738; Mon, 28 Jan 2019 16:04:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1548691485; bh=2qzd0+B6XblkdYmm48qera4WArBsBZcfgpLkVGqjXds=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ejAOrdaAYr1GioeAp3LOfHwpto/YYrs9ihMDaYvU0faqgSbY+FMtK+5yTdG0p4N1L UAA4bb25rhBKTWxeOdQkM1SYsbcaxdKCXbN6uCsw5ayvwvRzjCt0sqJGh58AZ4zPWX Yp5NSIy0h6wv7Cw9G2xNYSkMSbS2nxia7rOHmxGg= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Hoang Le , "David S . Miller" , Sasha Levin , netdev@vger.kernel.org, tipc-discussion@lists.sourceforge.net Subject: [PATCH AUTOSEL 4.19 110/258] tipc: fix node keep alive interval calculation Date: Mon, 28 Jan 2019 10:56:56 -0500 Message-Id: <20190128155924.51521-110-sashal@kernel.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190128155924.51521-1-sashal@kernel.org> References: <20190128155924.51521-1-sashal@kernel.org> MIME-Version: 1.0 X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Hoang Le [ 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