From patchwork Sun Mar 3 08:57:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eran Ben Elisha X-Patchwork-Id: 1050815 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=mellanox.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 44BxsX3Fnlz9s4Y for ; Sun, 3 Mar 2019 19:58:56 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726017AbfCCI5v (ORCPT ); Sun, 3 Mar 2019 03:57:51 -0500 Received: from mail-il-dmz.mellanox.com ([193.47.165.129]:36984 "EHLO mellanox.co.il" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725933AbfCCI5u (ORCPT ); Sun, 3 Mar 2019 03:57:50 -0500 Received: from Internal Mail-Server by MTLPINE1 (envelope-from eranbe@mellanox.com) with ESMTPS (AES256-SHA encrypted); 3 Mar 2019 10:57:39 +0200 Received: from dev-l-vrt-198.mtl.labs.mlnx (dev-l-vrt-198.mtl.labs.mlnx [10.134.198.1]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id x238vcjd005449; Sun, 3 Mar 2019 10:57:39 +0200 From: Eran Ben Elisha To: netdev@vger.kernel.org, "David S. Miller" Cc: Saeed Mahameed , Jiri Pirko , Eran Ben Elisha Subject: [PATCH net-next 1/3] devlink: Update reporter state to error even if recover aborted Date: Sun, 3 Mar 2019 10:57:29 +0200 Message-Id: <1551603451-22637-2-git-send-email-eranbe@mellanox.com> X-Mailer: git-send-email 1.8.4.3 In-Reply-To: <1551603451-22637-1-git-send-email-eranbe@mellanox.com> References: <1551603451-22637-1-git-send-email-eranbe@mellanox.com> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org If devlink_health_report() aborted the recover flow due to grace period checker, it left the reporter status as DEVLINK_HEALTH_REPORTER_STATE_HEALTHY, which is a bug. Fix that by always setting the reporter state to DEVLINK_HEALTH_REPORTER_STATE_ERROR prior to running the checker mentioned above. In addition, save the previous health_state in a temporary variable, then use it in the abort check comparison instead of using reporter->health_state which might be already changed. Fixes: c8e1da0bf923 ("devlink: Add health report functionality") Signed-off-by: Eran Ben Elisha Acked-by: Jiri Pirko --- net/core/devlink.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/net/core/devlink.c b/net/core/devlink.c index 6515fbec0dcd..376e01a70c6d 100644 --- a/net/core/devlink.c +++ b/net/core/devlink.c @@ -4569,16 +4569,19 @@ static int devlink_health_do_dump(struct devlink_health_reporter *reporter, int devlink_health_report(struct devlink_health_reporter *reporter, const char *msg, void *priv_ctx) { + enum devlink_health_reporter_state prev_health_state; struct devlink *devlink = reporter->devlink; /* write a log message of the current error */ WARN_ON(!msg); trace_devlink_health_report(devlink, reporter->ops->name, msg); reporter->error_count++; + prev_health_state = reporter->health_state; + reporter->health_state = DEVLINK_HEALTH_REPORTER_STATE_ERROR; /* abort if the previous error wasn't recovered */ if (reporter->auto_recover && - (reporter->health_state != DEVLINK_HEALTH_REPORTER_STATE_HEALTHY || + (prev_health_state != DEVLINK_HEALTH_REPORTER_STATE_HEALTHY || jiffies - reporter->last_recovery_ts < msecs_to_jiffies(reporter->graceful_period))) { trace_devlink_health_recover_aborted(devlink,