From patchwork Sat Jan 30 05:37:00 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: 8169601 Return-Path: X-Original-To: patchwork-linux-scsi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id EF26A9F96D for ; Sat, 30 Jan 2016 05:40:14 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0451720340 for ; Sat, 30 Jan 2016 05:40:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id EF4A420225 for ; Sat, 30 Jan 2016 05:40:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752387AbcA3FkJ (ORCPT ); Sat, 30 Jan 2016 00:40:09 -0500 Received: from mail-ob0-f172.google.com ([209.85.214.172]:35150 "EHLO mail-ob0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752203AbcA3FkG (ORCPT ); Sat, 30 Jan 2016 00:40:06 -0500 Received: by mail-ob0-f172.google.com with SMTP id ny8so58767624obc.2 for ; Fri, 29 Jan 2016 21:40:05 -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=c6aoKNIh8fywSLyzfFJ/Rb5kzHjvNCFGFtQ+wC64oyw=; b=MRqWYWRNEndLN1wT02rNp/i4tYK9dKIIhV88L1aWJnDTSfgz3IlfNoTs1QUA776raB k1d6/1Z3UnvD7U5cxu0xAzlOh06vTOQNW0J5u38gcCJd/45XVA1sm9auIXVUkSgVbdyx l3KEymLHhk0xtDjGagGpTX9R+Ru/l9fdtlUP7Si0GD1A9eBUE8+DoUKdcT9hg1Z8yIDs jYHuHhNZJy0QJHkla1mLwQYjsnRoufc7KeKWjnVGeIL9jgcSD14riGUliKz6FepExKTr WKe6nygDer62jIOYhybK8HydGyh48g5xlqwxDCuTKnEbSL/smYF51VjztjRGN7CAm3aM I0UA== 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=c6aoKNIh8fywSLyzfFJ/Rb5kzHjvNCFGFtQ+wC64oyw=; b=GZy3K4U0VIv0Ix0zdLgmzVAfjXH0ccZw7Sf6DARPm/x9yzGBslGK3gx8Faz1S3spOQ uENK6dh/WMzrSUoOVDe5WZMG+Mf5e4jsYJOkf4ZrYUu5Z7yvTS4h4hzdAEnp9fP0wqgr 7EbQyiN8R4klibtOAG81/8X5TcyGafoa+mmV1vDy6CsWtnowSi0Guah278vdrSuLEdIy g+hhdy5hOsh4UgHmuuWwWgJBWJgxjII+ls0M8iv3EQDkY+fvX/35avkwPqwYs50MYek4 ODx4xQpVJP7k2sVJyBhGNi/wDkBcAjNAKei8dyNxHrHi+/SJ+8Vdw6bJKRV3TguI+/PN ybVA== X-Gm-Message-State: AG10YOQt0uOW3lu2kfG0zWYBlhXT4sxdRM1tXZc1AuSQeotp52fECd3NAQFeYVst0NmuvA== X-Received: by 10.60.39.136 with SMTP id p8mr9864050oek.81.1454132405444; Fri, 29 Jan 2016 21:40:05 -0800 (PST) Received: from localhost.localdomain (mail.linux-iscsi.org. [67.23.28.174]) by smtp.gmail.com with ESMTPSA id x142sm9372191oix.8.2016.01.29.21.40.04 (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 29 Jan 2016 21:40:04 -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-v3 3/5] target: Fix TAS handling for multi-session se_node_acls Date: Sat, 30 Jan 2016 05:37:00 +0000 Message-Id: <1454132222-29009-4-git-send-email-nab@daterainc.com> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: <1454132222-29009-1-git-send-email-nab@daterainc.com> References: <1454132222-29009-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. Reviewed-by: Christoph Hellwig Cc: Quinn Tran Cc: Himanshu Madhani Cc: Sagi Grimberg Cc: Hannes Reinecke Cc: Andy Grover Cc: Mike Christie Cc: stable@vger.kernel.org # 3.10+ 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 c75ef29..9d67d16 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 @@ -278,7 +278,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) { @@ -369,7 +369,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); } } @@ -382,6 +382,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 @@ -400,8 +401,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", @@ -414,7 +416,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); /*