From patchwork Wed Mar 16 22:38:23 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Satish Kharat X-Patchwork-Id: 8605881 Return-Path: X-Original-To: patchwork-linux-scsi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 4D0A0C0553 for ; Wed, 16 Mar 2016 22:48:09 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 337C420212 for ; Wed, 16 Mar 2016 22:48:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3761C2020F for ; Wed, 16 Mar 2016 22:48:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752339AbcCPWsF (ORCPT ); Wed, 16 Mar 2016 18:48:05 -0400 Received: from alln-iport-1.cisco.com ([173.37.142.88]:7839 "EHLO alln-iport-1.cisco.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750955AbcCPWsD convert rfc822-to-8bit (ORCPT ); Wed, 16 Mar 2016 18:48:03 -0400 X-Greylist: delayed 575 seconds by postgrey-1.27 at vger.kernel.org; Wed, 16 Mar 2016 18:48:03 EDT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cisco.com; i=@cisco.com; l=9502; q=dns/txt; s=iport; t=1458168483; x=1459378083; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=DmgJcLlVoEht3Mei2V9rdKX7vbt/eYW8tOTxXmOm06o=; b=OPlj94j8AhRDVaWGAXaxI4Ru9jruZQy7YMWqdslCeQII13aE/s1DPQSy ZknhixiJDLJzIXrzxT8+fEUDvEKAe58kPngBiN4ka62F5UvRS8STVBGii hqVVZedwgYuD07y/wwmBvcdA23voGnkRlb4jnNCooAFOZ/aVdk14zk01x A=; X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A0ACAgBp3+lW/4UNJK1eg0aBQQaGAaUAA?= =?us-ascii?q?QSMcYIPAQ2Bb4YNAoFCOBQBAQEBAQEBZCeEQQEBAQMBJ1IFCwIBCA4DBAEBAQk?= =?us-ascii?q?lDyMdCAIEDgWIHwcBwGsBAQEBAQEBAQEBAQEBAQEBAQEBAQEVhh6ERIQ6hDwBB?= =?us-ascii?q?IIThUIIhhV5iGYBjgCPBY5+AR4BAUKCAxkUgTVqiWUBfQEBAQ?= X-IronPort-AV: E=Sophos;i="5.24,346,1454976000"; d="scan'208";a="250348288" Received: from alln-core-11.cisco.com ([173.36.13.133]) by alln-iport-1.cisco.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 16 Mar 2016 22:38:24 +0000 Received: from XCH-RCD-012.cisco.com (xch-rcd-012.cisco.com [173.37.102.22]) by alln-core-11.cisco.com (8.14.5/8.14.5) with ESMTP id u2GMcOL2009735 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=FAIL); Wed, 16 Mar 2016 22:38:24 GMT Received: from xch-rcd-012.cisco.com (173.37.102.22) by XCH-RCD-012.cisco.com (173.37.102.22) with Microsoft SMTP Server (TLS) id 15.0.1104.5; Wed, 16 Mar 2016 17:38:24 -0500 Received: from xch-rcd-012.cisco.com ([173.37.102.22]) by XCH-RCD-012.cisco.com ([173.37.102.22]) with mapi id 15.00.1104.009; Wed, 16 Mar 2016 17:38:23 -0500 From: "Satish Kharat (satishkh)" To: Ewan Milne CC: "linux-scsi@vger.kernel.org" Subject: Re: [PATCH 1/5] Fix to cleanup aborted IO to avoid device being offlined by mid-layer Thread-Topic: [PATCH 1/5] Fix to cleanup aborted IO to avoid device being offlined by mid-layer Thread-Index: AQHRfh1ZEJQNFbg0vEm+tuBXaOx3IJ9Zr4YAgAL6bKE= Date: Wed, 16 Mar 2016 22:38:23 +0000 Message-ID: <1458167903098.91502@cisco.com> References: <1457979262-26571-1-git-send-email-satishkh@cisco.com>, <1457985548.4188.26.camel@localhost.localdomain> In-Reply-To: <1457985548.4188.26.camel@localhost.localdomain> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [171.71.12.158] MIME-Version: 1.0 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Thanks for the review comments. I incorporated the comments, below is the updated patch: If an I/O times out and an abort issued by host, if the abort is successful we need to set scsi status as DID_ABORT. Or else the mid-layer error handler which looks for this error code, will offline the device. Also if the original I/O is not found in fnic firmware, we will consider the abort as successful. The start_time assignment is moved because of the new goto. Fnic driver version changed from 1.6.0.17a to 1.6.0.19, version 1.6.0.18 has been skipped Signed-off-by: Satish Kharat Reviewed-by: Ewan D. Milne --- drivers/scsi/fnic/fnic.h | 2 +- drivers/scsi/fnic/fnic_scsi.c | 35 +++++++++++++++++++++++++++++------ 2 files changed, 30 insertions(+), 7 deletions(-) diff --git a/drivers/scsi/fnic/fnic.h b/drivers/scsi/fnic/fnic.h index ce129e5..52a53f8 100644 --- a/drivers/scsi/fnic/fnic.h +++ b/drivers/scsi/fnic/fnic.h @@ -39,7 +39,7 @@ #define DRV_NAME "fnic" #define DRV_DESCRIPTION "Cisco FCoE HBA Driver" -#define DRV_VERSION "1.6.0.17a" +#define DRV_VERSION "1.6.0.19" #define PFX DRV_NAME ": " #define DFX DRV_NAME "%d: " diff --git a/drivers/scsi/fnic/fnic_scsi.c b/drivers/scsi/fnic/fnic_scsi.c index 266b909..b732fa3 100644 --- a/drivers/scsi/fnic/fnic_scsi.c +++ b/drivers/scsi/fnic/fnic_scsi.c @@ -1092,6 +1092,11 @@ static void fnic_fcpio_itmf_cmpl_handler(struct fnic *fnic, atomic64_inc( &term_stats->terminate_fw_timeouts); break; + case FCPIO_ITMF_REJECTED: + FNIC_SCSI_DBG(KERN_INFO, fnic->lport->host, + "abort reject recd. id %d\n", + (int)(id & FNIC_TAG_MASK)); + break; case FCPIO_IO_NOT_FOUND: if (CMD_FLAGS(sc) & FNIC_IO_ABTS_ISSUED) atomic64_inc(&abts_stats->abort_io_not_found); @@ -1112,9 +1117,15 @@ static void fnic_fcpio_itmf_cmpl_handler(struct fnic *fnic, spin_unlock_irqrestore(io_lock, flags); return; } - CMD_ABTS_STATUS(sc) = hdr_status; + CMD_FLAGS(sc) |= FNIC_IO_ABT_TERM_DONE; + /* If the status is IO not found consider it as success */ + if (hdr_status == FCPIO_IO_NOT_FOUND) + CMD_ABTS_STATUS(sc) = FCPIO_SUCCESS; + 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); @@ -1927,21 +1938,33 @@ int fnic_abort_cmd(struct scsi_cmnd *sc) CMD_STATE(sc) = FNIC_IOREQ_ABTS_COMPLETE; + start_time = io_req->start_time; /* * firmware completed the abort, check the status, - * free the io_req irrespective of failure or success + * free the io_req if successful. If abort fails, + * Device reset will clean the I/O. */ - if (CMD_ABTS_STATUS(sc) != FCPIO_SUCCESS) + if (CMD_ABTS_STATUS(sc) == FCPIO_SUCCESS) { + CMD_SP(sc) = NULL; + } + else + { ret = FAILED; - - CMD_SP(sc) = NULL; + spin_unlock_irqrestore(io_lock, flags); + goto fnic_abort_cmd_end; + } spin_unlock_irqrestore(io_lock, flags); - start_time = io_req->start_time; fnic_release_ioreq_buf(fnic, io_req, sc); mempool_free(io_req, fnic->io_req_pool); + if (sc->scsi_done) { + /* Call SCSI completion function to complete the IO */ + sc->result = (DID_ABORT << 16); + sc->scsi_done(sc); + } + fnic_abort_cmd_end: FNIC_TRACE(fnic_abort_cmd, sc->device->host->host_no, sc->request->tag, sc,