Received: by 10.213.65.68 with SMTP id h4csp1771318imn; Mon, 19 Mar 2018 12:49:47 -0700 (PDT) X-Google-Smtp-Source: AG47ELsrZXv/hVJDiPx7AJXoD09zLgJL0KjntJjHhjizHSwAbrZ1V9Ra2+zshvWsS2KdNx4QuqRF X-Received: by 2002:a17:902:7885:: with SMTP id q5-v6mr13428055pll.207.1521488987810; Mon, 19 Mar 2018 12:49:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521488987; cv=none; d=google.com; s=arc-20160816; b=Arjr5GD0LwlzPQ4cJ7+L5Kik3J32G30kLBwPNeru6lqYMVk0FPzNw5Yj2vwg5kvxy1 2/KB23kIN/9OjA9BNCN6tpwWuO27YR8Mq5wfjs7Y79LbwoVKbMK5iwYQneY/ax+wvJ88 RIrkIsME+4oNrxzfa1oRkIpF7JV0xOJ/VqcYsPOkShq3IG5IeeMIf49K03vpDxLpbI+f 1poEXDvK/Q3xMwhl2PYzJgFbGx8mTnooOnWHvSMSmI7bx6sz3bubQJU2AP3q41RiYtG4 pfoV7+u54GI/wcVtXAVAcvm3PeLO3Ucn7UKlTAhZAyvMErqqF3J71iwI2tLW/rYxwRnn mVVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=EoB40qHLU/55MGSt36sKKG4rxn1HMnk2qoqj9k79EH4=; b=bTKq2RXboRgEXX0vGpJi78VwO6YcZ4NYX4Xkj0ahX6NB5bxJ8aXrVC18+Siw7WjGQr /AIzWcV0nWOc0OniVOQ9l0TRBXzr2LeCwaxAbL1px5JtXsuuhVXMyjE8FjT0oqlZiwzT yOB+AHORaa3dptlduOX1Jrlzz7vALKNT2kaCyy7aHR/K24q3YJPEkrmCbUxH1FyhA7NX 2RYRDTWnYJjTtdrPAmY8rzkxYQhxKjKLE5106SonxBETWVXxsnlm14HJF+bWMQRKK71G x2HN8gA2TahEtYmpn/xx4TrdskA02qJH8FkzyIWCvOHYBuIz53WjOqMx5D5SqN1jBv4n LQtw== ARC-Authentication-Results: i=1; mx.google.com; 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 d16-v6si484098pli.557.2018.03.19.12.49.33; Mon, 19 Mar 2018 12:49:47 -0700 (PDT) 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; 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 S969954AbeCSTr6 (ORCPT + 99 others); Mon, 19 Mar 2018 15:47:58 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:47604 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S969509AbeCSSUS (ORCPT ); Mon, 19 Mar 2018 14:20:18 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id E4DF111A9; Mon, 19 Mar 2018 18:20:17 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Satish Kharat , Sesidhar Baddela , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 4.9 053/241] scsi: fnic: Fix for "Number of Active IOs" in fnicstats becoming negative Date: Mon, 19 Mar 2018 19:05:18 +0100 Message-Id: <20180319180753.416154897@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180319180751.172155436@linuxfoundation.org> References: <20180319180751.172155436@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: Satish Kharat [ Upstream commit 7ef539c88d7d394410d547c9f082d477093a2a22 ] Fixing the IO stats update (Active IOs and IO completion) to prevent "Number of Active IOs" from becoming negative in the fnistats output. Signed-off-by: Satish Kharat Signed-off-by: Sesidhar Baddela Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/scsi/fnic/fnic_scsi.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) --- a/drivers/scsi/fnic/fnic_scsi.c +++ b/drivers/scsi/fnic/fnic_scsi.c @@ -1127,12 +1127,6 @@ static void fnic_fcpio_itmf_cmpl_handler else CMD_ABTS_STATUS(sc) = hdr_status; - atomic64_dec(&fnic_stats->io_stats.active_ios); - if (atomic64_read(&fnic->io_cmpl_skip)) - atomic64_dec(&fnic->io_cmpl_skip); - else - atomic64_inc(&fnic_stats->io_stats.io_completions); - if (!(CMD_FLAGS(sc) & (FNIC_IO_ABORTED | FNIC_IO_DONE))) atomic64_inc(&misc_stats->no_icmnd_itmf_cmpls); @@ -1173,6 +1167,11 @@ static void fnic_fcpio_itmf_cmpl_handler (((u64)CMD_FLAGS(sc) << 32) | CMD_STATE(sc))); sc->scsi_done(sc); + atomic64_dec(&fnic_stats->io_stats.active_ios); + if (atomic64_read(&fnic->io_cmpl_skip)) + atomic64_dec(&fnic->io_cmpl_skip); + else + atomic64_inc(&fnic_stats->io_stats.io_completions); } } @@ -1962,6 +1961,11 @@ int fnic_abort_cmd(struct scsi_cmnd *sc) /* Call SCSI completion function to complete the IO */ sc->result = (DID_ABORT << 16); sc->scsi_done(sc); + atomic64_dec(&fnic_stats->io_stats.active_ios); + if (atomic64_read(&fnic->io_cmpl_skip)) + atomic64_dec(&fnic->io_cmpl_skip); + else + atomic64_inc(&fnic_stats->io_stats.io_completions); } fnic_abort_cmd_end: