From patchwork Sat Jan 23 01:37:47 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Nicholas A. Bellinger" X-Patchwork-Id: 8095331 Return-Path: X-Original-To: patchwork-linux-scsi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id A77CFBEEE5 for ; Sat, 23 Jan 2016 01:40:33 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 97C72202F2 for ; Sat, 23 Jan 2016 01:40:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 93375202F0 for ; Sat, 23 Jan 2016 01:40:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755807AbcAWBka (ORCPT ); Fri, 22 Jan 2016 20:40:30 -0500 Received: from mail-ob0-f169.google.com ([209.85.214.169]:33733 "EHLO mail-ob0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755839AbcAWBk1 (ORCPT ); Fri, 22 Jan 2016 20:40:27 -0500 Received: by mail-ob0-f169.google.com with SMTP id is5so77201757obc.0 for ; Fri, 22 Jan 2016 17:40:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daterainc-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=3aQzkFj9F2TB0NUOivWKxhhckBYM3UTO7meR0TwOdmg=; b=XfUFf+XdjDhYQRN7uBPU5gfHKF2JehQxoXuy1AA+A9+Keb1nCohaPqBTydLLtYHhzF TNsmG/xZq8jX6WYnA+ost+9cUa6FAg6gxQSWE3SfpGGxgqb5sAuAC0cj4ZwYn9aCVXeJ 8UrMQpiFBaSWqYTSKrn6T/U/D2bXEI1rDHwsJWCfHKZijPcSAR8OeZZ6XIIerAzpCWPD N5itVFIGRjUY5jKcBF3DrqL8kr5MGb6oluM5hn36P6O7ScGOFhbRR2hI2c8ZRa2Y3ufF U46aH4ga/HyECvdpFfPAdGDHjxlHaCDppfNqLGs2nzE+5gY5TBdnWfcZ9S/s/rripMoc h/ZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=3aQzkFj9F2TB0NUOivWKxhhckBYM3UTO7meR0TwOdmg=; b=QP0paNnzze90QhfAjmDWz2UNJko+n3OxIU7fSOGAV+8tyN+oaJtGQZ3NLAJ8wkjGnJ kLa3D67lyRRgglGfsuBiP5udwGiI3zTzNcY43D5FHSk0bZFyZ/NcDVRKaDu4sTWmMuj2 ua99JY6Db7vjSXvtvlHRAbGh4NNifNETiyTomAgFen3iZemZUUJPZILzbBT5d9z3YAGg 2ow53W0VGK124oQcK6gM5l7NB1ataofdfGFeFGISOVkoF1BRyPbG2mUMcm6nB/gCu2Hr gPXsXItHSJMB2jeL3hgc1fQ+RcbPh9zZ9ybjBRVVIKlxd6KMW+ozTGi9uqotQn1opVqa jtJg== X-Gm-Message-State: AG10YOSWc+L+i5KAAoMgkGSSJvBmPP/ZLgLbIWqJkeVPo00sg0AwP6zxWNScSafPTvnh1w== X-Received: by 10.60.33.10 with SMTP id n10mr4921835oei.66.1453513226715; Fri, 22 Jan 2016 17:40:26 -0800 (PST) Received: from localhost.localdomain (mail.linux-iscsi.org. [67.23.28.174]) by smtp.gmail.com with ESMTPSA id dj10sm4649276obb.14.2016.01.22.17.40.26 (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 22 Jan 2016 17:40:26 -0800 (PST) From: "Nicholas A. Bellinger" To: target-devel Cc: linux-scsi , Quinn Tran , Himanshu Madhani , Sagi Grimberg , Christoph Hellwig , Hannes Reinecke , Andy Grover , Mike Christie , Nicholas Bellinger Subject: [PATCH-v2 3/3] target: Fix TAS handling for multi-session se_node_acls Date: Sat, 23 Jan 2016 01:37:47 +0000 Message-Id: <1453513067-23169-4-git-send-email-nab@daterainc.com> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: <1453513067-23169-1-git-send-email-nab@daterainc.com> References: <1453513067-23169-1-git-send-email-nab@daterainc.com> Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Nicholas Bellinger This patch fixes a bug in TMR task aborted status (TAS) handling when multiple sessions are connected to the same target WWPN endpoint and se_node_acl descriptor, resulting in TASK_ABORTED status to not be generated for aborted se_cmds on the remote port. This is due to core_tmr_handle_tas_abort() incorrectly comparing se_node_acl instead of se_session, for which the multi-session case is expected to be sharing the same se_node_acl. Instead, go ahead and update core_tmr_handle_tas_abort() to compare tmr_sess + cmd->se_sess in order to determine if the LUN_RESET was received on a different I_T nexus, and TASK_ABORTED status response needs to be generated. Cc: Quinn Tran Cc: Himanshu Madhani Cc: Sagi Grimberg Cc: Christoph Hellwig Cc: Hannes Reinecke Cc: Andy Grover Cc: Mike Christie Signed-off-by: Nicholas Bellinger Reviewed-by: Christoph Hellwig --- drivers/target/target_core_tmr.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/drivers/target/target_core_tmr.c b/drivers/target/target_core_tmr.c index d4f30aa..3eff563 100644 --- a/drivers/target/target_core_tmr.c +++ b/drivers/target/target_core_tmr.c @@ -76,7 +76,7 @@ void core_tmr_release_req(struct se_tmr_req *tmr) } static void core_tmr_handle_tas_abort( - struct se_node_acl *tmr_nacl, + struct se_session *tmr_sess, struct se_cmd *cmd, int tas) { @@ -84,7 +84,7 @@ static void core_tmr_handle_tas_abort( /* * TASK ABORTED status (TAS) bit support */ - if ((tmr_nacl && (tmr_nacl != cmd->se_sess->se_node_acl)) && tas) { + if ((tmr_sess && (tmr_sess != cmd->se_sess)) && tas) { remove = false; transport_send_task_abort(cmd); } @@ -111,7 +111,7 @@ static bool __target_check_io_state(struct se_cmd *se_cmd) { struct se_session *sess = se_cmd->se_sess; - assert_spin_locked(&se_session->sess_cmd_lock); + assert_spin_locked(&sess->sess_cmd_lock); WARN_ON_ONCE(!irqs_disabled()); /* * If command already reached CMD_T_COMPLETE state within @@ -272,7 +272,7 @@ static void core_tmr_drain_tmr_list( static void core_tmr_drain_state_list( struct se_device *dev, struct se_cmd *prout_cmd, - struct se_node_acl *tmr_nacl, + struct se_session *tmr_sess, int tas, struct list_head *preempt_and_abort_list) { @@ -364,7 +364,7 @@ static void core_tmr_drain_state_list( cancel_work_sync(&cmd->work); transport_wait_for_tasks(cmd); - core_tmr_handle_tas_abort(tmr_nacl, cmd, tas); + core_tmr_handle_tas_abort(tmr_sess, cmd, tas); target_put_sess_cmd(cmd); } } @@ -377,6 +377,7 @@ int core_tmr_lun_reset( { struct se_node_acl *tmr_nacl = NULL; struct se_portal_group *tmr_tpg = NULL; + struct se_session *tmr_sess = NULL; int tas; /* * TASK_ABORTED status bit, this is configurable via ConfigFS @@ -395,8 +396,9 @@ int core_tmr_lun_reset( * or struct se_device passthrough.. */ if (tmr && tmr->task_cmd && tmr->task_cmd->se_sess) { - tmr_nacl = tmr->task_cmd->se_sess->se_node_acl; - tmr_tpg = tmr->task_cmd->se_sess->se_tpg; + tmr_sess = tmr->task_cmd->se_sess; + tmr_nacl = tmr_sess->se_node_acl; + tmr_tpg = tmr_sess->se_tpg; if (tmr_nacl && tmr_tpg) { pr_debug("LUN_RESET: TMR caller fabric: %s" " initiator port %s\n", @@ -409,7 +411,7 @@ int core_tmr_lun_reset( dev->transport->name, tas); core_tmr_drain_tmr_list(dev, tmr, preempt_and_abort_list); - core_tmr_drain_state_list(dev, prout_cmd, tmr_nacl, tas, + core_tmr_drain_state_list(dev, prout_cmd, tmr_sess, tas, preempt_and_abort_list); /*