From patchwork Wed Dec 6 07:08:17 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 10094979 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 930BC60327 for ; Wed, 6 Dec 2017 07:08:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8820429B6E for ; Wed, 6 Dec 2017 07:08:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7BC7429B70; Wed, 6 Dec 2017 07:08:26 +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,RCVD_IN_DNSWL_HI autolearn=ham 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 2B9B729B6E for ; Wed, 6 Dec 2017 07:08:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752305AbdLFHIZ (ORCPT ); Wed, 6 Dec 2017 02:08:25 -0500 Received: from mx1.redhat.com ([209.132.183.28]:54572 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752176AbdLFHIZ (ORCPT ); Wed, 6 Dec 2017 02:08:25 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5954E883CD; Wed, 6 Dec 2017 07:08:25 +0000 (UTC) Received: from rh2.redhat.com (ovpn-120-63.rdu2.redhat.com [10.10.120.63]) by smtp.corp.redhat.com (Postfix) with ESMTP id 41904795BF; Wed, 6 Dec 2017 07:08:22 +0000 (UTC) From: Mike Christie To: target-devel@vger.kernel.org, lixiubo@cmss.chinamobile.com, nab@linux-iscsi.org Cc: Mike Christie Subject: [RFC PATCH 1/3] target: add SAM_STAT_BUSY sense reason Date: Wed, 6 Dec 2017 01:08:17 -0600 Message-Id: <1512544099-7520-2-git-send-email-mchristi@redhat.com> In-Reply-To: <1512544099-7520-1-git-send-email-mchristi@redhat.com> References: <1512544099-7520-1-git-send-email-mchristi@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Wed, 06 Dec 2017 07:08:25 +0000 (UTC) Sender: target-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: target-devel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add SAM_STAT_BUSY sense_reason. The next patch will have target_core_user return this value while it is temporarily blocked and restarting. Signed-off-by: Mike Christie --- drivers/target/target_core_transport.c | 3 +++ include/target/target_core_base.h | 1 + 2 files changed, 4 insertions(+) diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c index 58caacd..74b646f 100644 --- a/drivers/target/target_core_transport.c +++ b/drivers/target/target_core_transport.c @@ -1774,6 +1774,9 @@ void transport_generic_request_failure(struct se_cmd *cmd, case TCM_OUT_OF_RESOURCES: cmd->scsi_status = SAM_STAT_TASK_SET_FULL; goto queue_status; + case TCM_LUN_BUSY: + cmd->scsi_status = SAM_STAT_BUSY; + goto queue_status; case TCM_RESERVATION_CONFLICT: /* * No SENSE Data payload for this case, set SCSI Status diff --git a/include/target/target_core_base.h b/include/target/target_core_base.h index 2c8d811..00482f9 100644 --- a/include/target/target_core_base.h +++ b/include/target/target_core_base.h @@ -183,6 +183,7 @@ enum tcm_sense_reason_table { TCM_TOO_MANY_SEGMENT_DESCS = R(0x1b), TCM_UNSUPPORTED_SEGMENT_DESC_TYPE_CODE = R(0x1c), TCM_INSUFFICIENT_REGISTRATION_RESOURCES = R(0x1d), + TCM_LUN_BUSY = R(0x1e), #undef R };