From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4EBA5C43464 for ; Thu, 17 Sep 2020 23:19:02 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A0E3320838 for ; Thu, 17 Sep 2020 23:19:01 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="xV/4ULyS"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="iVtxeI5g" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A0E3320838 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-nvme-bounces+linux-nvme=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=dqG/bFSrJPigoXZbpfM+H4yKdIPE8Jr+4P9r09yUezg=; b=xV/4ULyStGcDtAlTZkXW+pUsy Ms18ApgOYNSEIQos/0050EayZT69kcmr8mLBCEympsmyIS9M+7Vtny0Vo6cRhL1S7JU1AwQULhaDM wb7n+awamXS/ecS8hCJZnVP6bG1pbrhwu2sFNlVkwpcAjOe3tSubS7THlBBPAVlEEv6SrTl+3SEWW Hs/1yIB8sLUsL5KbuVH4p/48lj7HTyfuitqdlC8dj7P/s6aKlVNcq1wDHlI9IAEbnIozkr2dG023t wBTrSIBFT3uM0mMrejWUUWs0EzJi7mjp5XqcAPq1967RxE78MAJtkllx95GfYOEWpkZUu0DymTfFi GwWduOlyg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kJ3B4-0008SZ-Ak; Thu, 17 Sep 2020 23:18:58 +0000 Received: from mail.kernel.org ([198.145.29.99]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kJ3Ay-0008Pz-PJ for linux-nvme@lists.infradead.org; Thu, 17 Sep 2020 23:18:54 +0000 Received: from dhcp-10-100-145-180.wdl.wdc.com (unknown [199.255.45.60]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 9BC4D208DB; Thu, 17 Sep 2020 23:18:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600384732; bh=NK+w8QmqYf/nABcVzn9HY5/sKPUjVEcVkvH9cPa0NoA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iVtxeI5gG8IWEwou6juCMvirC4F1CJz5MyfCOZlYlrwq/8ZUhAuB8Hv3RaWos+O6y 4d8W0hKOyJT5Qa9TdTTbwBonySmPC+2EO3m21pKt+/me/NB2argoB1pPHm2gP9l84e q1xwb+WE99zZ5exwGEpNA1RIbOgmCPSxkWwdH8xo= From: Keith Busch To: linux-nvme@lists.infradead.org, sagi@grimberg.me, hch@lst.de, linux-block@vger.kernel.org Subject: [PATCHv3 4/4] scsi: handle zone resources errors Date: Thu, 17 Sep 2020 16:18:41 -0700 Message-Id: <20200917231841.4029747-5-kbusch@kernel.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200917231841.4029747-1-kbusch@kernel.org> References: <20200917231841.4029747-1-kbusch@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200917_191852_893350_649A81F2 X-CRM114-Status: GOOD ( 14.18 ) X-BeenThere: linux-nvme@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: axboe@kernel.dk, Johannes Thumshirn , Damien Le Moal , martin.petersen@oracle.com, linux-scsi@vger.kernel.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "Linux-nvme" Errors-To: linux-nvme-bounces+linux-nvme=archiver.kernel.org@lists.infradead.org From: Damien Le Moal ZBC or ZAC disks that have a limit on the number of open zones may fail a zone open command or a write to a zone that is not already implicitly or explicitly open if the total number of open zones is already at the maximum allowed. For these operations, instead of returning the generic BLK_STS_IOERR, return BLK_STS_ZONE_OPEN_RESOURCE which is returned as -ETOOMANYREFS to the I/O issuer, allowing the device user to act appropriately on these relatively benign zone resource errors. Cc: Christoph Hellwig Cc: Johannes Thumshirn Signed-off-by: Damien Le Moal --- drivers/scsi/scsi_lib.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 7affaaf8b98e..c129ac6666da 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -758,6 +758,15 @@ static void scsi_io_completion_action(struct scsi_cmnd *cmd, int result) /* See SSC3rXX or current. */ action = ACTION_FAIL; break; + case DATA_PROTECT: + action = ACTION_FAIL; + if ((sshdr.asc == 0x0C && sshdr.ascq == 0x12) || + (sshdr.asc == 0x55 && + (sshdr.ascq == 0x0E || sshdr.ascq == 0x0F))) { + /* Insufficient zone resources */ + blk_stat = BLK_STS_ZONE_OPEN_RESOURCE; + } + break; default: action = ACTION_FAIL; break; -- 2.24.1 _______________________________________________ Linux-nvme mailing list Linux-nvme@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-nvme