From patchwork Sun Oct 27 14:05:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Damien Le Moal X-Patchwork-Id: 11214095 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 45FB71920 for ; Sun, 27 Oct 2019 14:05:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 239F421850 for ; Sun, 27 Oct 2019 14:05:59 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=wdc.com header.i=@wdc.com header.b="ReGtvGg2" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726889AbfJ0OF6 (ORCPT ); Sun, 27 Oct 2019 10:05:58 -0400 Received: from esa2.hgst.iphmx.com ([68.232.143.124]:11568 "EHLO esa2.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726541AbfJ0OF6 (ORCPT ); Sun, 27 Oct 2019 10:05:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1572185231; x=1603721231; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=YzelDqYrFynhZQWAEiup5vbFP24VklL5nBubfM2krqU=; b=ReGtvGg2y0vbVYteaDE5Mkepn01YCY1R/IS+JWNku5zOUCrup1SOoIPt NO0yssREu2FSu+P0LT2Na66Unal1gQYrW/yYp6vc4mRAF7+e6CS9Q+KpV LMjwi+VqJxfLjdvEoN8X/qknBJwFS8u63JK/4VIBv/sHaluQZ68+l8+ht BlrTO0Iq1NaVD7A3Mav6Tt9EC13hXOsEdhEsbNnm9cWqj6MHLovM2ouAU AnxpcGGdpBIyjqn+6QHNYYN/Rwv/EZGoN2eTLFcRW3WQdAFgHy+TCQt++ Fc0MXMTYY/wrC3WxNBq2mZOPeeHCaoYYgPe6MQtnxtIObWCs1EOIRNzyh Q==; IronPort-SDR: xctl2oLCt65nguT4zKPN9LDJQpPOhS+rEIWA+ONMUfX20L5RKJ69rnrUEbteAhH5ANRH0u3tit qj5NRsipljdIsVrSOi6aour5Z/SHGqj//dISUnmYEadHrBGN/z6lKjLuziighnieTNQc/XJaGx 4vRHx2NEeEDdP+RXsY85EmCNvFzz5WCMLui/ZMIDGCzTTFdKH5wt/reESnyoD154Ao4RB2/p2k B+aeLQWBdnkEfxu7+QHvmuJrXTSrGVQ+0IbP0hdVQ0poxV0PVkewUbPKUitM/z+O4/sMgFAidV gkE= X-IronPort-AV: E=Sophos;i="5.68,236,1569254400"; d="scan'208";a="222578539" Received: from h199-255-45-14.hgst.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 27 Oct 2019 22:07:10 +0800 IronPort-SDR: GJ7MLSWlvjFD3tqhYtmjElRlJu3a5AbdJcKVTk6jwG0qWLAg0Kpnu7HTLIG/fgVxwWDM5bsru2 poXWNTMr/JkFngPZ1RbkXDPPqojzH2TGUtzf9WnC9mCH5RRZR4dltc67eGBz1Hi4QU9SuMjw6K xEnjfz7A92UJnguuBYQp4YAcnuNBepsU6F6uCGEyH2FSqlAIeMRVizPeaZlnW49bu5r0pqnYZ2 ZdB1M9Lq77u9456xlz95NbOEnv04xBQ1N7k/5iX+RGfs+ld1rTGkqBnxH5wKxnJ7tetgOPCRC5 rHqQnj2SE60JmQH5dD76x+Of Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Oct 2019 07:01:21 -0700 IronPort-SDR: uR98BDGb+oDCDl3aGAlMSwA0kM5bmjHUYEmzwIJdBaAnbIiG4wxWUs96BTPpyfSFVgv89PwrYn RH+tv5S0a748uqvVul6hso9M+kfuaBVmTJZBpOAT/Fo1JDEBdn1G6Cxvnt9rFQOdQLuiFyi6vr 8s+VoUBcvoPOHWBap2dkA3k0uHknUkvrl3wD5qAPpQM2+XHdToK8arSo4HKSE8bv07RgMqUHLH IsdvHPotDFKSSmEmNfEfTAbE8hO1JSEcEW8mUp6r+4rBQYzSIHdw+wYiWyFVZxYBm+anB6dSiE l5k= WDCIronportException: Internal Received: from washi.fujisawa.hgst.com ([10.149.53.254]) by uls-op-cesaip01.wdc.com with ESMTP; 27 Oct 2019 07:05:56 -0700 From: Damien Le Moal To: linux-block@vger.kernel.org, Jens Axboe , linux-scsi@vger.kernel.org, "Martin K . Petersen" , dm-devel@redhat.com, Mike Snitzer Cc: Ajay Joshi , Matias Bjorling , Hans Holmberg , Dmitry Fomichev , Keith Busch Subject: [PATCH 3/8] scsi: sd_zbc: Fix sd_zbc_complete() Date: Sun, 27 Oct 2019 23:05:44 +0900 Message-Id: <20191027140549.26272-4-damien.lemoal@wdc.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20191027140549.26272-1-damien.lemoal@wdc.com> References: <20191027140549.26272-1-damien.lemoal@wdc.com> MIME-Version: 1.0 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org The ILLEGAL REQUEST/INVALID FIELD IN CDB error generated by an attempt to reset a conventional zone does not apply to the reset write pointer command with the ALL bit set, that is, to REQ_OP_ZONE_RESET_ALL requests. Fix sd_zbc_complete() to be quiet only in the case of REQ_OP_ZONE_RESET, excluding REQ_OP_ZONE_RESET_ALL. Since REQ_OP_ZONE_RESET is the only request handled by sd_zbc_complete(), also simplify the code using a simple if statement. Fixes: d81e9d494354 ("scsi: implement REQ_OP_ZONE_RESET_ALL") Cc: stable@vger.kernel.org Signed-off-by: Damien Le Moal Reviewed-by: Martin K. Petersen --- drivers/scsi/sd_zbc.c | 29 ++++++++++------------------- 1 file changed, 10 insertions(+), 19 deletions(-) diff --git a/drivers/scsi/sd_zbc.c b/drivers/scsi/sd_zbc.c index de4019dc0f0b..1efc69e194f8 100644 --- a/drivers/scsi/sd_zbc.c +++ b/drivers/scsi/sd_zbc.c @@ -263,25 +263,16 @@ void sd_zbc_complete(struct scsi_cmnd *cmd, unsigned int good_bytes, int result = cmd->result; struct request *rq = cmd->request; - switch (req_op(rq)) { - case REQ_OP_ZONE_RESET: - case REQ_OP_ZONE_RESET_ALL: - - if (result && - sshdr->sense_key == ILLEGAL_REQUEST && - sshdr->asc == 0x24) - /* - * INVALID FIELD IN CDB error: reset of a conventional - * zone was attempted. Nothing to worry about, so be - * quiet about the error. - */ - rq->rq_flags |= RQF_QUIET; - break; - - case REQ_OP_WRITE: - case REQ_OP_WRITE_ZEROES: - case REQ_OP_WRITE_SAME: - break; + if (req_op(rq) == REQ_OP_ZONE_RESET && + result && + sshdr->sense_key == ILLEGAL_REQUEST && + sshdr->asc == 0x24) { + /* + * INVALID FIELD IN CDB error: reset of a conventional + * zone was attempted. Nothing to worry about, so be + * quiet about the error. + */ + rq->rq_flags |= RQF_QUIET; } }