From patchwork Sun Feb 7 03:18: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: 8243701 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 9495C9F1C1 for ; Sun, 7 Feb 2016 03:21:24 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A026E2022A for ; Sun, 7 Feb 2016 03:21:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A6E70201EC for ; Sun, 7 Feb 2016 03:21:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752227AbcBGDVT (ORCPT ); Sat, 6 Feb 2016 22:21:19 -0500 Received: from mail-oi0-f41.google.com ([209.85.218.41]:36187 "EHLO mail-oi0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753250AbcBGDVP (ORCPT ); Sat, 6 Feb 2016 22:21:15 -0500 Received: by mail-oi0-f41.google.com with SMTP id x21so63461783oix.3 for ; Sat, 06 Feb 2016 19:21:15 -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=zfAT3eaR9oYiNVn/Ak1SlPIFtYEVNxeLN+PYZs12Dho=; b=iNtELnYKhnOqte6E8Xfb/sdlGng5ccH8S40G2AVnyRvxzqU3XLvcNK1rO/HaEApSEO 1NbLDAM1JyDxqQh57z7LO0oiGEO1c3HSI/3i9eJKMRd/XQJ25bIjVB/eYuR3LhfWPTKJ hGxjbTPokTMU6Ed22ZsT6hqobPs5RFXgWTmkmj6wPBAdKclVqMQnyXqolG42iryoZgAI rI/q/6WRW5kl7cq97ngejuzFChQRAfgFPyhB9c0dv01LZKnvs5kT8NnA1J2XIkZeiGJY cauU1fjM8iRdnsA3/o0c4UzV9+I1ntvlmZuHcgtmcBazK4MNiE07P//39sYd/0lr/PnT VarA== 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=zfAT3eaR9oYiNVn/Ak1SlPIFtYEVNxeLN+PYZs12Dho=; b=SISLfYNt9j0Hwteo3n4fc9ZYW4CRB+0M57Zr9a3giig0yzNSncMxBn6AcrgUsxV++7 ljsatioayHH5UNMk/CKtxXuOh59cCmHXt19eOGMV57v5iXvtou6s9nZgL1XoZeusKQIB 52I9DkD4PuZ6lR2dpxuyxhwX7u4ITNAO1QaqZ1LRJOFjenXQY2UFKPHeFbzzGEutj+KU r381Nr0xUPChdeSKVrnbIyhDJnTo1MZQi/SvgG6YC8BKIBeun55tHGDj91X7VsvXi99l OfsmzkVJVweXnk0BUjdsftzSocorSWCHBTB6ICbwv9mQaonyy51PCq6vni3TGqjmzuy3 3OvA== X-Gm-Message-State: AG10YOSXqbKF655+0Y+HcPCFuR0NCRJN6sIS9jCh834YjNNq7Os2xxm5Xjjyvx3blVMHwg== X-Received: by 10.202.222.135 with SMTP id v129mr14158313oig.139.1454815275195; Sat, 06 Feb 2016 19:21:15 -0800 (PST) Received: from localhost.localdomain (mail.linux-iscsi.org. [67.23.28.174]) by smtp.gmail.com with ESMTPSA id e188sm8424803oih.29.2016.02.06.19.21.14 (version=TLS1 cipher=AES128-SHA bits=128/128); Sat, 06 Feb 2016 19:21:14 -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-v4 3/5] target: Fix TAS handling for multi-session se_node_acls Date: Sun, 7 Feb 2016 03:18:00 +0000 Message-Id: <1454815082-15380-4-git-send-email-nab@daterainc.com> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: <1454815082-15380-1-git-send-email-nab@daterainc.com> References: <1454815082-15380-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=-7.2 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 --- drivers/target/target_core_tmr.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/drivers/target/target_core_tmr.c b/drivers/target/target_core_tmr.c index 072af07..3e0d77a 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); } @@ -273,7 +273,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); /*