From patchwork Sat Jun 3 05:35:43 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Nicholas A. Bellinger" X-Patchwork-Id: 9763877 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 7EB6860360 for ; Sat, 3 Jun 2017 05:35:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 65D7B285A1 for ; Sat, 3 Jun 2017 05:35:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 482B2285EE; Sat, 3 Jun 2017 05:35:48 +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 32AAC285A1 for ; Sat, 3 Jun 2017 05:35:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750765AbdFCFfq (ORCPT ); Sat, 3 Jun 2017 01:35:46 -0400 Received: from mail.linux-iscsi.org ([67.23.28.174]:58099 "EHLO linux-iscsi.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750759AbdFCFfq (ORCPT ); Sat, 3 Jun 2017 01:35:46 -0400 Received: from [192.168.1.66] (75-37-194-224.lightspeed.lsatca.sbcglobal.net [75.37.194.224]) (using SSLv3 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: nab) by linux-iscsi.org (Postfix) with ESMTPSA id 59A5040B11; Sat, 3 Jun 2017 05:38:46 +0000 (UTC) Message-ID: <1496468143.27407.302.camel@haakon3.risingtidesystems.com> Subject: Re: [PATCH 12/33] target: Add target_send_busy() From: "Nicholas A. Bellinger" To: Bart Van Assche Cc: "hch@lst.de" , "ddiss@suse.de" , "target-devel@vger.kernel.org" , "agrover@redhat.com" Date: Fri, 02 Jun 2017 22:35:43 -0700 In-Reply-To: <1496423510.1214.13.camel@sandisk.com> References: <20170523234854.21452-1-bart.vanassche@sandisk.com> <20170523234854.21452-13-bart.vanassche@sandisk.com> <1496378686.27407.245.camel@haakon3.risingtidesystems.com> <1496423510.1214.13.camel@sandisk.com> X-Mailer: Evolution 3.4.4-1 Mime-Version: 1.0 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 On Fri, 2017-06-02 at 17:11 +0000, Bart Van Assche wrote: > On Thu, 2017-06-01 at 21:44 -0700, Nicholas A. Bellinger wrote: > > On Tue, 2017-05-23 at 16:48 -0700, Bart Van Assche wrote: > > > Introduce a function that sends the SCSI status "BUSY" back to the > > > initiator. > > > > > > Signed-off-by: Bart Van Assche > > > Reviewed-by: Hannes Reinecke > > > Cc: Christoph Hellwig > > > Cc: Andy Grover > > > Cc: David Disseldorp > > > --- > > > drivers/target/target_core_transport.c | 10 ++++++++++ > > > include/target/target_core_fabric.h | 1 + > > > 2 files changed, 11 insertions(+) > > > > > > diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c > > > index cfe69c1fc879..c28e3b58150b 100644 > > > --- a/drivers/target/target_core_transport.c > > > +++ b/drivers/target/target_core_transport.c > > > @@ -3130,6 +3130,16 @@ transport_send_check_condition_and_sense(struct se_cmd *cmd, > > > } > > > EXPORT_SYMBOL(transport_send_check_condition_and_sense); > > > > > > +int target_send_busy(struct se_cmd *cmd) > > > +{ > > > + WARN_ON_ONCE(cmd->se_cmd_flags & SCF_SCSI_TMR_CDB); > > > + > > > + cmd->scsi_status = SAM_STAT_BUSY; > > > + trace_target_cmd_complete(cmd); > > > + return cmd->se_tfo->queue_status(cmd); > > > +} > > > +EXPORT_SYMBOL(target_send_busy); > > > + > > > > This doesn't handle queue-full, or any of the other interesting failure > > conditions. > > > > It really needs to be using the normal completion path that already > > handles all of those cases instead. > > Hello Nic, > > Have you noticed that this function is *only* used if target_submit_tmr() > fails and that the normal completion path is not triggered at all if > target_submit_tmr() fails? Doesn't matter. If common code is added to target-core it needs to work for all cases, and handle error conditions. > > > That said, MNC and I are working on a patch to allow this. > > Which patch are you referring to? Has it already been posted on the > target-devel mailing list? > Yes. The bottom part of http://www.spinics.net/lists/target-devel/msg11835.html And more recently MNC's version: http://www.spinics.net/lists/target-devel/msg15436.html --- To unsubscribe from this list: send the line "unsubscribe target-devel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c index 6becc94..eb12ae2 100644 --- a/drivers/target/target_core_transport.c +++ b/drivers/target/target_core_transport.c @@ -732,11 +732,20 @@ static unsigned char *transport_get_sense_buffer(struct se_cmd *cmd) void target_complete_cmd(struct se_cmd *cmd, u8 scsi_status) { struct se_device *dev = cmd->se_dev; - int success = scsi_status == GOOD; + int success; unsigned long flags; cmd->scsi_status = scsi_status; - + switch (cmd->scsi_status) { + case SAM_STAT_GOOD: + case SAM_STAT_BUSY: + case SAM_STAT_TASK_SET_FULL: + success = 1; + break; + default: + success = 0; + break; + } spin_lock_irqsave(&cmd->t_state_lock, flags); cmd->transport_state &= ~CMD_T_BUSY;