From patchwork Tue Feb 28 10:25:35 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Damien Le Moal X-Patchwork-Id: 9595111 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 350FD60453 for ; Tue, 28 Feb 2017 10:29:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 41DFE27F60 for ; Tue, 28 Feb 2017 10:29:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 36F0A28520; Tue, 28 Feb 2017 10:29:29 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9081128518 for ; Tue, 28 Feb 2017 10:29:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752059AbdB1K2q (ORCPT ); Tue, 28 Feb 2017 05:28:46 -0500 Received: from esa1.hgst.iphmx.com ([68.232.141.245]:23318 "EHLO esa1.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751709AbdB1K23 (ORCPT ); Tue, 28 Feb 2017 05:28:29 -0500 X-IronPort-AV: E=Sophos;i="5.35,218,1483977600"; d="scan'208";a="99640255" Received: from mail-by2nam01lp0182.outbound.protection.outlook.com (HELO NAM01-BY2-obe.outbound.protection.outlook.com) ([216.32.181.182]) by ob1.hgst.iphmx.com with ESMTP; 28 Feb 2017 18:26:06 +0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sharedspace.onmicrosoft.com; s=selector1-wdc-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=sV2h+ooQItjp1k/pbDfREpASqRdxhWXEFXCaBJt66HQ=; b=FokakKP/fYgnYZ8yqf2uJ0TSAvfbwHPIewF/Q4P34/QF4KC1RJ/kK+nt1KsuQH/LdukMI8IUaQF1KHxiEdF3kC6SmYW1M+7VMJ/7xDrCtXg3bzKpk2BCn0EjfNCRDAxCORhsc7ECvhYHOEtHSol/Y4rKkuWlQFumeLlPnOCimfQ= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Damien.LeMoal@wdc.com; Received: from washi.fujisawa.hgst.com (199.255.44.5) by BY2PR04MB1973.namprd04.prod.outlook.com (10.166.111.13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.947.12; Tue, 28 Feb 2017 10:26:03 +0000 From: Damien Le Moal To: Jens Axboe , linux-block@vger.kernel.org, "Martin K . Petersen" , linux-scsi@vger.kernel.org Cc: MPT-FusionLinux.pdl@broadcom.com, Hannes Reinecke , Christoph Hellwig , Bart Van Assche Subject: [PATCH 3/3] mpt3sas: Do not check resid for non medium access commands Date: Tue, 28 Feb 2017 19:25:35 +0900 Message-Id: <20170228102535.15966-4-damien.lemoal@wdc.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170228102535.15966-1-damien.lemoal@wdc.com> References: <20170228102535.15966-1-damien.lemoal@wdc.com> MIME-Version: 1.0 X-Originating-IP: [199.255.44.5] X-ClientProxiedBy: MWHPR1201CA0013.namprd12.prod.outlook.com (10.174.253.23) To BY2PR04MB1973.namprd04.prod.outlook.com (10.166.111.13) X-MS-Office365-Filtering-Correlation-Id: 0a9caa30-26f6-4840-27b7-08d45fc433c3 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(48565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kRWdF0uwp3dVEXe02z+tBb2IjohQie33/kzYTgcwlNFv1m6; 20:32EMCYqDqqb3mSAb4L7HjLPEQuUZdSDtMG0W56Mrpooj4Mbo+HPY3S5z76ApPgog2fotTHwuDxW+telhRGkSNrLlPcScaSYR6ExrIP2dX4QbLvrcfTv1D4eRw7mZCowMmNdNnBwDOCups+k+f0TSva8MLnpqxa+dQz2pGrFcEnLlMtbV1ssTmvlK3niUR6QbcAYMjRSuUIcTcvFbc3HbZp9TVsUjE6453Sx1TkzoS4+itrVkQmWSjc9a1RwnI3SLJQsyfqRFkC6LimIJjMOUcn8AxqCf49zaCGgsVH5GaDwemszGIBByb4MWeh6BVrJDHKmILezhypq/Vh0tcdpjAajshI41u6L4QdidDMAuFCWyuHR5wF/U4RYTAtmBM2aR0DGDkgM41fJFJLmOs22a4AqJoCSzuph0AEEArU31LzvtsXLoE5kQ6sTYsb2eq3xNpvCWLi2cHWibobXrEB5sjv1Pg8u95Mb43RQP64DHgghMr908VRDUnp1NCjt03O2g X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(42932892334569); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040375)(601004)(2401047)(8121501046)(5005006)(3002001)(10201501046)(6055026)(6041248)(20161123558025)(20161123564025)(20161123562025)(20161123555025)(20161123560025)(6072148); SRVR:BY2PR04MB1973; BCL:0; PCL:0; RULEID:; SRVR:BY2PR04MB1973; X-Microsoft-Exchange-Diagnostics: 1; BY2PR04MB1973; 4:ZuKMw6X/2xINQbaZOD+nX/CMAOstoi8N8RWgmT4g6DdbVPXSUXh/Dzoh9+58uzYhs7+3EJ21/m4Y9+nR0Z9Z7BBL0PXTxepsJ39OhjjH1rHlNYgX8GvD+Q+XldZnAxNAUI9rWHPqlOOrTw9QaohjRL62M/pEgYnSYr3sWClapBGmZiVbWKl1D6TODRriwrfjsF4ZPVybLI07rHtKQ/aXNxjiWxeOvusHxb/4QW8/RGlbJ5f0jmYlTmwdkXFlexzB6XTLU1ZjtywBw5AAxqxuYew6Yhd9ZbQVBT/hRSKHgKMwu3JRhgTgmQ47eGObgI+t18UKiZGXL5UE1qSU5pCCXvXqTjdN3dPrOOVX8RmumqR+t1eEGLncIrJXpHy+54Tcs9M7O+x5l/OnWi+GK91izWQLjWo3v8oTqah/LM0hlJd5O0TtzVbdeI+5iKZqxNdhsgeWMX625vnHhLRJyq2AaYu3TmqYCgep4yEYnVxZ26EIxeF0USa1vpCO7dIY6Mpaxloz5Vt1nnkV0yRmLqkGASeXsUIZXaiNvOwJlSCxTgNwgf2KcBWeyTSi6LEktVoMeEL4xIhaEB/wxYwZNaylJl7qM3s32d7/GOphH6ZeLcvPT16U2miNJ9XjgonNZU/SibDYjbuRcy8Vy+/077airxDt2FOf1v84hiH62pLKdew= X-Forefront-PRVS: 0232B30BBC X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(4630300001)(6009001)(7916002)(39450400003)(39840400002)(39860400002)(39410400002)(39850400002)(199003)(189002)(6506006)(6666003)(36756003)(101416001)(2950100002)(6486002)(50226002)(189998001)(81166006)(81156014)(76176999)(50466002)(54906002)(6512007)(50986999)(25786008)(305945005)(7736002)(5660300001)(8676002)(97736004)(48376002)(53936002)(92566002)(2906002)(4326007)(33646002)(6116002)(107886003)(38730400002)(3846002)(5003940100001)(1076002)(105586002)(106356001)(68736007)(42186005)(86362001)(66066001)(47776003)(7099028)(5005270100013)(32563001); DIR:OUT; SFP:1102; SCL:1; SRVR:BY2PR04MB1973; H:washi.fujisawa.hgst.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: wdc.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BY2PR04MB1973; 23:9QJVGN9pfMGWWFWPtnriAK2zEFkyn4JXD8E9SewNp?= =?us-ascii?Q?AjpdwWt3QAdIOYUrn61XEdz73xXzia/seXTnb2D88oAFvxTUqON1uTtqKu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IVzV4YSYr10HgfOEjur0M5ul+ILZFnnLh56OUMdc1i8rAgQ1S2oLacchcchma+FoOkgmiMg3q+3ZctzCrKWFqnmPnuhCEo9KQQ= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BY2PR04MB1973; 7:79w7JLefVVZaeblhbqm6MwxZnXNcXyoInjFpmjahpYU3Owt/7k3sF4xFPCK1h2TDObNuyfuYVUWA9WCqd8ONGBrcjVXmV80GUHdn2atCLZO9FyRvm2lmD3AHUftp79Wx0kxh+SF0nIftmcjpGjx0SNr1Nza7pODo7nOi81LK7luVN/MPR+Q+JfEzRyXHBpkHs+1d8+6yvCKJ7iKdC0A1ERh7h6GFa2P2ysEDRLa98AyJlNJ8xugBxFVzGBTqNdEYEdvVTSxnRzuOyvm/VbSeuf2GegyKUDsCQvu+qdCkBT0iu4ka73ejfRRTMIeP6v8kFTurMSpQyXtWRicCaBAImA==; 20:UkleP2nmu9UQIYsrSb5QGpSAHpm6SuuX2Mcz6gyA8/bHqSLAiLROqzrmqZ10OCm2TbDw1UhOZqj7f74eAasxqi0A8DXPX8ztVOiWKBOdxd2X3hRV+3Fr7tw5WK85T1sEo/P0CClL4zQ3DGrnK2rpOiCdRjVCYYWQhm7eJL+wQLk6rPC+PZZYNCPe/TPtItco50yFlNqDjHTDFtmAJlZOEQrNCraeT6NNt4EQVchTebP91pM8jKhXb0WA7b0N5WRu X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Feb 2017 10:26:03.5081 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR04MB1973 Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Bart Van Assche Commit f2e767bb5d6e ("mpt3sas: Force request partial completion alignment") introduced a forced alignment of resid to the device logical block size to fix bogus HBA firmware sometimes returning an unaligned value. This fix however did not consider the case of commands not operating on logical block size units (e.g. REQ_OP_ZONE_REPORT and its 64B aligned partial replies). This could result is incorrectly aligning resid for these commands, which for REQ_OP_REPORT_ZONES result in the inability to determine the number of zone descriptors returned. Fix the resid alignment check to exclude all requests that are not medium access requests using blk_rq_access_medium(). This will exclude from the resid forced fix all passthrough requests as well as zone command requests. Fixes: f2e767bb5d6e ("mpt3sas: Force request partial completion alignment") Signed-off-by: Bart Van Assche --- drivers/scsi/mpt3sas/mpt3sas_scsih.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c b/drivers/scsi/mpt3sas/mpt3sas_scsih.c index 46e866c..405dc84 100644 --- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c +++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c @@ -4748,8 +4748,8 @@ _scsih_io_done(struct MPT3SAS_ADAPTER *ioc, u16 smid, u8 msix_index, u32 reply) * then scsi-ml does not need to handle this misbehavior. */ sector_sz = scmd->device->sector_size; - if (unlikely(!blk_rq_is_passthrough(scmd->request) && sector_sz && - xfer_cnt % sector_sz)) { + if (unlikely(sector_sz && (xfer_cnt & (sector_sz - 1)) && + blk_rq_accesses_medium(scmd->request))) { sdev_printk(KERN_INFO, scmd->device, "unaligned partial completion avoided (xfer_cnt=%u, sector_sz=%u)\n", xfer_cnt, sector_sz);