Received: by 10.223.185.116 with SMTP id b49csp1113416wrg; Sat, 3 Mar 2018 15:59:24 -0800 (PST) X-Google-Smtp-Source: AG47ELuAobSeVUOkShN5dK1QrFrGqLgF3JUNClvN8Vv7IJCDor1mOxP+307/dAna01KaxIyWcrwH X-Received: by 10.98.17.86 with SMTP id z83mr10451647pfi.207.1520121564801; Sat, 03 Mar 2018 15:59:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520121564; cv=none; d=google.com; s=arc-20160816; b=dqnD7vqKq+ndPpQa47RZF4PNJxFXMVGChS2PocNCTRSaV2cku5zrmkmivq7L9n4MJ0 QMaYkakWLv5mJLlZUQ7neFlCrfoPS/1G5Cjkk5due5rWHIPtkVDP2sjfvMYL6U1AVaSz FQ+MMv4A3k2yX8ANiYPVuand8F3Mwdx0eOmWEH0GdYd1req3MuFbksNMT7k0RLP3R/8P A1+YQrvRozUiSnoWOGhQEYLTa4+4yw+vP27AoVJuOeDeGZL8upK+nDtT53BwVOQQSCYC rMYrFOdpSux6kuBivmb5wH2lRB8UZ8UTrPhrHEtTH04JTtN72Ze+td7KPvFSU950k4iy clMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=prFox4Cnuqe0guV2GGMjOkRAsSKCQvunPRkq0hO78X4=; b=nBvq+I0nKvVc+WCWfxJyfnGnQKRLGBRCZBUzPVK4ZfQ2/85QK6y5HunRgUkLZuRF9u n/5hqqwbo477dpKHob3PG+x6NYQlbb+pm2oRKfQKJGfSv2zuP5zPFc8RynQ4e9q5jIgP F8gW21ia8LuHAOXnFpQ7Pzp317GBkBvZnpMYztkEtdmzfrjf+pabsavBoMOVE6ws+Ujn vlcUsgIUXFZqPuk7lYjCAUuR9chi9YADwMZZOM/4ayCNA8P6bWUMssuOcicn2pwHKm7v AkErnDh17eVp9r9hY7rY7a4Ywam/sb3FdUZjSAH9IOrdbDIspJb7cd6Xa5CR/naXWERh dgYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=k0XESZDP; 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=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i124si5399224pgd.576.2018.03.03.15.59.10; Sat, 03 Mar 2018 15:59:24 -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=@microsoft.com header.s=selector1 header.b=k0XESZDP; 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=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752566AbeCCX6R (ORCPT + 99 others); Sat, 3 Mar 2018 18:58:17 -0500 Received: from mail-by2nam03on0115.outbound.protection.outlook.com ([104.47.42.115]:54496 "EHLO NAM03-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S933821AbeCCWcX (ORCPT ); Sat, 3 Mar 2018 17:32:23 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=prFox4Cnuqe0guV2GGMjOkRAsSKCQvunPRkq0hO78X4=; b=k0XESZDPrOGUFhHDTfjJJP1PUKr7wyOy0FX1tGnXkiJ8k955R55IutRauEgyYFOAtyHVvxrPuI3c3Zcy4DjqIoq2lLCOarhHRdaJ06R6u0JKubvqsjoLt+TQEDdA6c3KhgWebIqu1sdUTGSMAYqcZBDipb/uT0DUNq580PZnEUY= Received: from MW2PR2101MB1034.namprd21.prod.outlook.com (52.132.149.10) by MW2PR2101MB1036.namprd21.prod.outlook.com (52.132.149.12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.567.3; Sat, 3 Mar 2018 22:32:15 +0000 Received: from MW2PR2101MB1034.namprd21.prod.outlook.com ([fe80::1d56:338f:e2b:cec0]) by MW2PR2101MB1034.namprd21.prod.outlook.com ([fe80::1d56:338f:e2b:cec0%3]) with mapi id 15.20.0567.006; Sat, 3 Mar 2018 22:32:15 +0000 From: Sasha Levin To: "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" CC: Satish Kharat , Sesidhar Baddela , "Martin K . Petersen" , Sasha Levin Subject: [PATCH AUTOSEL for 4.9 055/219] scsi: fnic: Fix for "Number of Active IOs" in fnicstats becoming negative Thread-Topic: [PATCH AUTOSEL for 4.9 055/219] scsi: fnic: Fix for "Number of Active IOs" in fnicstats becoming negative Thread-Index: AQHTsz7zlVNh2T8eMk6hN6s0pBNcWA== Date: Sat, 3 Mar 2018 22:28:28 +0000 Message-ID: <20180303222716.26640-55-alexander.levin@microsoft.com> References: <20180303222716.26640-1-alexander.levin@microsoft.com> In-Reply-To: <20180303222716.26640-1-alexander.levin@microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [52.168.54.252] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;MW2PR2101MB1036;7:AQODEIK9rd9nCQZYRr66s4pMbSgbmacgSuxUOdKh3BdEyUbjhULWZhwdsIrTWKNiqw3xrYRONW5C8yoWUKYrebsJqudfVRbEzj4uPoh5HB1SBn5HcTcWo/L//9RsntGPly8iuWW8gDGtCPCk+Ps2Sv08a42ufPlXR77fOW2E3beZqQhafeMmvLQ/rBEI803gl8tsn7NN334cptNh8gIA33YqTvIXRTybJlRAi2pgPbHLZTaqxoqzLr5Tc2OsO0n9 x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 0417b733-3266-44a2-8f16-08d581569dec x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(4534165)(4627221)(201703031133081)(201702281549075)(48565401081)(5600026)(4604075)(3008032)(2017052603307)(7193020);SRVR:MW2PR2101MB1036; x-ms-traffictypediagnostic: MW2PR2101MB1036: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(89211679590171)(95692535739014)(146099531331640); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(8211001083)(61425038)(6040501)(2401047)(8121501046)(5005006)(93006095)(93001095)(3231220)(944501244)(52105095)(3002001)(10201501046)(6055026)(61426038)(61427038)(6041288)(20161123562045)(20161123564045)(20161123558120)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011);SRVR:MW2PR2101MB1036;BCL:0;PCL:0;RULEID:;SRVR:MW2PR2101MB1036; x-forefront-prvs: 0600F93FE1 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(396003)(366004)(39380400002)(346002)(376002)(39860400002)(199004)(189003)(10290500003)(81166006)(5660300001)(107886003)(8936002)(81156014)(3846002)(6506007)(2906002)(8676002)(3280700002)(59450400001)(72206003)(76176011)(4326008)(478600001)(6116002)(6486002)(53936002)(1076002)(68736007)(6512007)(102836004)(2501003)(66066001)(3660700001)(5250100002)(6436002)(105586002)(86612001)(36756003)(316002)(7736002)(97736004)(26005)(186003)(110136005)(305945005)(22452003)(86362001)(99286004)(6666003)(25786009)(106356001)(2900100001)(14454004)(54906003)(10090500001)(2950100002)(22906009)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:MW2PR2101MB1036;H:MW2PR2101MB1034.namprd21.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: 74pyB9/x8w/eLz5u7ZZN2b6yRuDG70dpTgch429gENXQiJS/iJOMeHqUHAlXV9JWiiKsd+yKTn3WeDE3dTyRqLKQCRs7k/wH/y3uvNnf4A0s6kSaMfqv0foP+F+6n3WlCHZyDJKjeVFKKWqdn2d5iRuqVl/nxSoEO9IL9SSTmIU= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0417b733-3266-44a2-8f16-08d581569dec X-MS-Exchange-CrossTenant-originalarrivaltime: 03 Mar 2018 22:28:28.2756 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW2PR2101MB1036 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- drivers/scsi/fnic/fnic_scsi.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/drivers/scsi/fnic/fnic_scsi.c b/drivers/scsi/fnic/fnic_scsi.c index 44dd372aa7d3..c056b8111ad2 100644 --- 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(struct fnic= *fnic, else CMD_ABTS_STATUS(sc) =3D hdr_status; =20 - 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); =20 @@ -1173,6 +1167,11 @@ static void fnic_fcpio_itmf_cmpl_handler(struct fnic= *fnic, (((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); } } =20 @@ -1962,6 +1961,11 @@ int fnic_abort_cmd(struct scsi_cmnd *sc) /* Call SCSI completion function to complete the IO */ sc->result =3D (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); } =20 fnic_abort_cmd_end: --=20 2.14.1