Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp3017649ybt; Mon, 29 Jun 2020 13:02:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzqGACX4V+bav1MVsGOnybjek1N64QcVpAZR0/i4Ck3I6KAZeixJYa+XQXBM74dRDUS/CYP X-Received: by 2002:a17:906:17c8:: with SMTP id u8mr15654895eje.129.1593460936753; Mon, 29 Jun 2020 13:02:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593460936; cv=none; d=google.com; s=arc-20160816; b=XHsFOT1/aqrxDX8FqC83nYKvu7xytk0YeQU4GlglD2xgz5LwYFkOJzkFnDhzGPLDZI THP4jg1Lctbza/WTfVRvEKgK6ng5YmdfeVBMTAsBMRa8haXbFdpMLHy4p5LKyhTCNPjO ZpB35shTfsOXpYH7QlwUnfsikZqvfpFJjIitkcu/WH+NRl1DS6QcwOU+iUp23sVVc/Rp Y3Pl/DI/f8F0ylwUr2hEfUOfL3wq2IyNuoCk9RA3e2dR+mabqn2ZlvEHGdAZj5/VSqdU 8wQu0APDMBTzjf26U50OztjBSx8/rz/9VK7o3wP7XR0U/5darsYB0EK8AigQozk0cvsO LRqQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=/MGdbr/VdkS7PlgMFTq0+7iBtXlktysbp40N0nHIJMI=; b=IblYrhBW2xT1Fa4xptUxLhWAJj3bF1zUStumgSZzZLEapJYol3CiRE63WbDZmYmjjm B5w/x7eiPkRfpx6mCSMN6SJjWf9m4gzqxwbZ9kB71HQEZgC71ySHmGQSQv8/egpB/Uir /lRGRHuEOe9Dl1XZyG2fyWQ3P1thsZafSF3O6Rr32gGdXoU7THs59B7wRpjynPhnYcFy B6fz6OFsaNl+T38y0VSUQCBsJouoFNOpJICO2nJ0JH7IKbXFtFU/epp1m2K/KdUr/tnB c7vzis/KldYMnzyuASqBDnEjeSoxrwdHNZEE9V9vTEL65SFo/eNAQwTXq2W+SVHinXJn ibQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ybdZvFml; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c3si312661edr.308.2020.06.29.13.01.53; Mon, 29 Jun 2020 13:02:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ybdZvFml; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388398AbgF2T7r (ORCPT + 99 others); Mon, 29 Jun 2020 15:59:47 -0400 Received: from mail.kernel.org ([198.145.29.99]:47670 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387568AbgF2TkR (ORCPT ); Mon, 29 Jun 2020 15:40:17 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 9736624875; Mon, 29 Jun 2020 15:26:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1593444372; bh=78G/8cjf9PgRo9JXjCPxoSNhAZS8BC6RIKWrqBpwcIo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ybdZvFml2dRyULSlMnUmKO0MvS+CazIn1ZmDHF+CkLMzptdA37NS1QO1sPrWb3wLW vuE+kB6VHsA8jeuOr64y0p3I/LR16zfrUZehcM89tjnn+ru4/zq12rTGRxTvmcDtwg WOQWgnvxOV0HAdxw5GOh+0D/crcNwUVOpv9Y9B1E= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Roman Bolshakov , Quinn Tran , Arun Easi , Nilesh Javali , Bart Van Assche , Daniel Wagner , Himanshu Madhani , Martin Wilck , Shyam Sundar , "Martin K . Petersen" , Greg Kroah-Hartman Subject: [PATCH 5.4 049/178] scsi: qla2xxx: Keep initiator ports after RSCN Date: Mon, 29 Jun 2020 11:23:14 -0400 Message-Id: <20200629152523.2494198-50-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200629152523.2494198-1-sashal@kernel.org> References: <20200629152523.2494198-1-sashal@kernel.org> MIME-Version: 1.0 X-KernelTest-Patch: http://kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.4.50-rc1.gz X-KernelTest-Tree: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git X-KernelTest-Branch: linux-5.4.y X-KernelTest-Patches: git://git.kernel.org/pub/scm/linux/kernel/git/stable/stable-queue.git X-KernelTest-Version: 5.4.50-rc1 X-KernelTest-Deadline: 2020-07-01T15:25+00:00 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Roman Bolshakov commit 632f24f09d5b7c8a2f94932c3391ca957ae76cc4 upstream. The driver performs SCR (state change registration) in all modes including pure target mode. For each RSCN, scan_needed flag is set in qla2x00_handle_rscn() for the port mentioned in the RSCN and fabric rescan is scheduled. During the rescan, GNN_FT handler, qla24xx_async_gnnft_done() deletes session of the port that caused the RSCN. In target mode, the session deletion has an impact on ATIO handler, qlt_24xx_atio_pkt(). Target responds with SAM STATUS BUSY to I/O incoming from the deleted session. qlt_handle_cmd_for_atio() and qlt_handle_task_mgmt() return -EFAULT if they are not able to find session of the command/TMF, and that results in invocation of qlt_send_busy(): qlt_24xx_atio_pkt_all_vps: qla_target(0): type 6 ox_id 0014 qla_target(0): Unable to send command to target, sending BUSY status Such response causes command timeout on the initiator. Error handler thread on the initiator will be spawned to abort the commands: scsi 23:0:0:0: tag#0 abort scheduled scsi 23:0:0:0: tag#0 aborting command qla2xxx [0000:af:00.0]-188c:23: Entered qla24xx_abort_command. qla2xxx [0000:af:00.0]-801c:23: Abort command issued nexus=23:0:0 -- 0 2003. Command abort is rejected by target and fails (2003), error handler then tries to perform DEVICE RESET and TARGET RESET but they're also doomed to fail because TMFs are ignored for the deleted sessions. Then initiator makes BUS RESET that resets the link via qla2x00_full_login_lip(). BUS RESET succeeds and brings initiator port up, SAN switch detects that and sends RSCN to the target port and it fails again the same way as described above. It never goes out of the loop. The change breaks the RSCN loop by keeping initiator sessions mentioned in RSCN payload in all modes, including dual and pure target mode. Link: https://lore.kernel.org/r/20200605144435.27023-1-r.bolshakov@yadro.com Fixes: 2037ce49d30a ("scsi: qla2xxx: Fix stale session") Cc: Quinn Tran Cc: Arun Easi Cc: Nilesh Javali Cc: Bart Van Assche Cc: Daniel Wagner Cc: Himanshu Madhani Cc: Martin Wilck Cc: stable@vger.kernel.org # v5.4+ Reviewed-by: Daniel Wagner Reviewed-by: Shyam Sundar Reviewed-by: Himanshu Madhani Signed-off-by: Roman Bolshakov Signed-off-by: Martin K. Petersen Signed-off-by: Greg Kroah-Hartman --- drivers/scsi/qla2xxx/qla_gs.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/qla2xxx/qla_gs.c b/drivers/scsi/qla2xxx/qla_gs.c index 84bb4a0480166..a44de4c5dcf6c 100644 --- a/drivers/scsi/qla2xxx/qla_gs.c +++ b/drivers/scsi/qla2xxx/qla_gs.c @@ -3638,7 +3638,9 @@ void qla24xx_async_gnnft_done(scsi_qla_host_t *vha, srb_t *sp) qla2x00_clear_loop_id(fcport); fcport->flags |= FCF_FABRIC_DEVICE; } else if (fcport->d_id.b24 != rp->id.b24 || - fcport->scan_needed) { + (fcport->scan_needed && + fcport->port_type != FCT_INITIATOR && + fcport->port_type != FCT_NVME_INITIATOR)) { qlt_schedule_sess_for_deletion(fcport); } fcport->d_id.b24 = rp->id.b24; -- 2.25.1