Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A9AB0C433F5 for ; Fri, 26 Nov 2021 02:36:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1357962AbhKZCjP (ORCPT ); Thu, 25 Nov 2021 21:39:15 -0500 Received: from mail.kernel.org ([198.145.29.99]:48172 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351723AbhKZChL (ORCPT ); Thu, 25 Nov 2021 21:37:11 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 871D16115B; Fri, 26 Nov 2021 02:32:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1637893961; bh=as5tJYuTCWOWSTEALSBQe2QSq/HyeoW71HBw5oiJU4Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Yk1hN5JUemTA+z3/w4K0jBeIcIpwtyVhQbUWnFoutkLQwnKq8w5TpsYBRDApXBVu2 ASI4Ju2P3l02uZa2eehXTHKrvgrudPxNBkUSqezw8/KM46tty9OthURf1D++c3aN/4 welaOw/NcLFk5xO/zO9XhF47Ta9KbI4v3wlAJl9VXf7QqeB9t8d9UqO4YUPLiILwl+ oqaZeT15XW7S1ILHUKbgsWIRenq9bAfmol/1QWUgcowbS1HZyVsEzBXwf8iFp3hyXe y2jDG4QwRPgVl99u/dmi+QlXD9/28vXUTFOqaGrl/agPWQRs8Jr/sCaDsVCluH7U7A ddTnfnXf3HBZA== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Mike Christie , Lee Duncan , "Martin K . Petersen" , Sasha Levin , cleech@redhat.com, jejb@linux.ibm.com, open-iscsi@googlegroups.com, linux-scsi@vger.kernel.org Subject: [PATCH AUTOSEL 5.15 22/39] scsi: iscsi: Unblock session then wake up error handler Date: Thu, 25 Nov 2021 21:31:39 -0500 Message-Id: <20211126023156.441292-22-sashal@kernel.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211126023156.441292-1-sashal@kernel.org> References: <20211126023156.441292-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Mike Christie [ Upstream commit a0c2f8b6709a9a4af175497ca65f93804f57b248 ] We can race where iscsi_session_recovery_timedout() has woken up the error handler thread and it's now setting the devices to offline, and session_recovery_timedout()'s call to scsi_target_unblock() is also trying to set the device's state to transport-offline. We can then get a mix of states. For the case where we can't relogin we want the devices to be in transport-offline so when we have repaired the connection __iscsi_unblock_session() can set the state back to running. Set the device state then call into libiscsi to wake up the error handler. Link: https://lore.kernel.org/r/20211105221048.6541-2-michael.christie@oracle.com Reviewed-by: Lee Duncan Signed-off-by: Mike Christie Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin --- drivers/scsi/scsi_transport_iscsi.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c index 78343d3f93857..554b6f7842236 100644 --- a/drivers/scsi/scsi_transport_iscsi.c +++ b/drivers/scsi/scsi_transport_iscsi.c @@ -1899,12 +1899,12 @@ static void session_recovery_timedout(struct work_struct *work) } spin_unlock_irqrestore(&session->lock, flags); - if (session->transport->session_recovery_timedout) - session->transport->session_recovery_timedout(session); - ISCSI_DBG_TRANS_SESSION(session, "Unblocking SCSI target\n"); scsi_target_unblock(&session->dev, SDEV_TRANSPORT_OFFLINE); ISCSI_DBG_TRANS_SESSION(session, "Completed unblocking SCSI target\n"); + + if (session->transport->session_recovery_timedout) + session->transport->session_recovery_timedout(session); } static void __iscsi_unblock_session(struct work_struct *work) -- 2.33.0