Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp875836pxk; Thu, 17 Sep 2020 20:01:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyERy+ytZJ2Q/HOfoaF2ttdqj5ak/cgCvbACzRXCB1geZ4FgGd5SbQPk2AF2luNMiqVIqYd X-Received: by 2002:a17:906:455:: with SMTP id e21mr35411743eja.170.1600398117035; Thu, 17 Sep 2020 20:01:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600398117; cv=none; d=google.com; s=arc-20160816; b=n8EPtmEQWabRiU5ZMTOsXaOF3EejBG8pQ5Z55zpQ1JFiOUOArbU4glJ7/aoHVu6pvu SjgaFsap4zy3fovi7OMUFOzdGpuHTYDRaFyyzOOqEx6OtHng+OHV3XaaEsu88QdJj5H9 Yywy4ko3EKGRvuixuUQZCSCMpZQjGrXq6SgKAUQ+HCXTqf4ScEbFMhaEMxgWpE3+0O6g x9P5BeDcf3iXWoeE47WiG7nHqwrFNKIPZiFkQWCvnED7lk9f1CI33z9tJ7sIKbcwwTTl 1OqWQ6e/OJEhlsionsGoxgjiGlLWmyS7lCTsqx2ng64YwCmDmriybQSOQpZtu1WH8O+w kkJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=c4hgVs5RksYGzN3HW1wIWFhygie9zBFA3f66oUutsnU=; b=UNKravGdEctPGbtH4dFpnTdeokaqNDWsYOYHNPKcGYjmOa+/raGKO/6WWKjqRC1+Al v/xXNV7BtDjhTAjNA9XlOPGUwMQU6fSUPp3ZqGCRPA0kry+yEQLjnMjZQ8B66KtgKtOx ypDFZeXiYpUTP/bzDUB4Px9R+W5JCcilkhcD49OSTsHcYIqWeOak7XE08Qro2G03DhA5 o6KOrS0/E///TqUN5kcMx44XFkufB5NR31PgEZ3D2a7THqNzCziy2fjG2TEA8rXEbSAu 3+uPMWdBdCTeZovaaXk/oKHy2CpSczReGF1BSLEijlUIYehbZ88UFhisXBGvDy7W2Pbh +wLg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=oRlTA8PP; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h21si1125388edq.257.2020.09.17.20.01.33; Thu, 17 Sep 2020 20:01:57 -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=oRlTA8PP; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729448AbgIRC6S (ORCPT + 99 others); Thu, 17 Sep 2020 22:58:18 -0400 Received: from mail.kernel.org ([198.145.29.99]:55550 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727743AbgIRCGT (ORCPT ); Thu, 17 Sep 2020 22:06:19 -0400 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 D08442388E; Fri, 18 Sep 2020 02:06:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600394778; bh=KlyB1V7trltBZqapT92xp/ft/alNfcd/5PzlcK1on1w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oRlTA8PPxt9Pepq6SkToBjum3szvkM4m9BAqdI0TsLjilzAj94tXPmQ0k1KGH66Eb gzBrNKvPfse/MQgdTfs9jJF+M3lm4grnJu9DVEaGtwqsCzceEKZk2xZwlOszgOzNE8 e0Mfprh9pQ9JNbIodXMZ/CJdyEDMQdOn5PHGfJjQ= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Aya Levin , Moshe Shemesh , Jiri Pirko , "David S . Miller" , Sasha Levin , netdev@vger.kernel.org Subject: [PATCH AUTOSEL 5.4 252/330] devlink: Fix reporter's recovery condition Date: Thu, 17 Sep 2020 21:59:52 -0400 Message-Id: <20200918020110.2063155-252-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200918020110.2063155-1-sashal@kernel.org> References: <20200918020110.2063155-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Aya Levin [ Upstream commit bea0c5c942d3b4e9fb6ed45f6a7de74c6b112437 ] Devlink health core conditions the reporter's recovery with the expiration of the grace period. This is not relevant for the first recovery. Explicitly demand that the grace period will only apply to recoveries other than the first. Fixes: c8e1da0bf923 ("devlink: Add health report functionality") Signed-off-by: Aya Levin Reviewed-by: Moshe Shemesh Reviewed-by: Jiri Pirko Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- net/core/devlink.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/net/core/devlink.c b/net/core/devlink.c index 5667cae57072f..26c8993a17ae0 100644 --- a/net/core/devlink.c +++ b/net/core/devlink.c @@ -4823,6 +4823,7 @@ int devlink_health_report(struct devlink_health_reporter *reporter, { enum devlink_health_reporter_state prev_health_state; struct devlink *devlink = reporter->devlink; + unsigned long recover_ts_threshold; /* write a log message of the current error */ WARN_ON(!msg); @@ -4832,10 +4833,12 @@ int devlink_health_report(struct devlink_health_reporter *reporter, reporter->health_state = DEVLINK_HEALTH_REPORTER_STATE_ERROR; /* abort if the previous error wasn't recovered */ + recover_ts_threshold = reporter->last_recovery_ts + + msecs_to_jiffies(reporter->graceful_period); if (reporter->auto_recover && (prev_health_state != DEVLINK_HEALTH_REPORTER_STATE_HEALTHY || - jiffies - reporter->last_recovery_ts < - msecs_to_jiffies(reporter->graceful_period))) { + (reporter->last_recovery_ts && reporter->recovery_count && + time_is_after_jiffies(recover_ts_threshold)))) { trace_devlink_health_recover_aborted(devlink, reporter->ops->name, reporter->health_state, -- 2.25.1