Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp3180120pxb; Mon, 18 Apr 2022 18:16:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx/MfSTNUt3ao2AbmVlNeDkFvtj0Emj2Kigzcqpvy97ynvDIvbOkGzkjezgRJETXqHtkNpd X-Received: by 2002:a62:1c8d:0:b0:4fa:8dcb:6da2 with SMTP id c135-20020a621c8d000000b004fa8dcb6da2mr15006882pfc.19.1650330961955; Mon, 18 Apr 2022 18:16:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650330961; cv=none; d=google.com; s=arc-20160816; b=haFlNjKMHhez7IgfYj74/QZ+TIUOJ/9ozlqmB1W1NGHxXzAUewSRx9hdTPLdfntp/Y ma3OWOuDNWW7kpIAL2hbjf/E7bM12+xJi7ZBf796krY4IFgk/AMSYIfj04T8S1VQPNBk PM7bfommUPbmjWyfuyv0JROAJf49t8XqGgJkmcqUKDuQSQR/tjEnUJ7zRXI2VIukjVVq d/V7vv7tTBySe3e+cqJ9YFN7o0tmNsPPPbfgmCmUQ/nE5XsgLNdbi65EEVbArkmWoyk1 doUKyQzB1uufmOKcgkhVGEY07eXzxr9DzWNAJEBZQbKZSEBk0wd2iuuvKc0CPwVy14Ds lnYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=3pO37MLi0LIU3m2PHEvoLiM2AFN3FNRUSts1DgwaYeA=; b=o1Yc7jplIwIasdnCSqSs8IUOP3PZSYgZ+VmkFSxdNsbQIwxSicRM92rfBS02xTEhfB 9ky0mtUr1YOGtirhaorKeL2TD2PVlehWjcsF21d0FO31UvYCcheOOSnjN7YXWU5TU+cn XOkuj4jrl1ML+5pW1pk+Ubu6Cs17sHlV4TVMXrdt+IQTpRm9scDdPeJch64lfScl8hPn TZC1CdD6eKWMGxb+NY3f40d7k7plxM5GH+RDeWhetb/4eJv8m5WyC/+pOWeEC8C8g5IG Uz1ukPIa2qHeOsUICnjD4Tt3iKgFsuydmuLwgzvZ/CJQemSFFPa2VUa7r2o/obNZGug/ +n9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=fNWUWWYS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id fu1-20020a17090ad18100b001cb475fa87bsi760186pjb.116.2022.04.18.18.15.46; Mon, 18 Apr 2022 18:16:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=fNWUWWYS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242426AbiDRNJF (ORCPT + 99 others); Mon, 18 Apr 2022 09:09:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41824 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240394AbiDRM4m (ORCPT ); Mon, 18 Apr 2022 08:56:42 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9355B12755; Mon, 18 Apr 2022 05:37:54 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id CFC2D611CC; Mon, 18 Apr 2022 12:37:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DB34AC385B0; Mon, 18 Apr 2022 12:37:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1650285473; bh=plLRFRABPQzeHzsPhuHHKYd36CfjqlRb/871J9RPo7c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fNWUWWYSSjCIVBO6l43URLG922pn7pYfgOPpGuBDbjPzqbHQ5h+V31jF0vB4AeeGO C0Wt1Tr5Ar0mHsF5Fd2Z2G5MizZ//OSNJZKnPr4NzGcySuWxxCpFMy2uh49HRFcDBp 6syWbWnSljxYUhU7OQh2Aq+MM6CepFi/kOy95/ao= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mike Christie , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.10 028/105] scsi: iscsi: Force immediate failure during shutdown Date: Mon, 18 Apr 2022 14:12:30 +0200 Message-Id: <20220418121147.114581108@linuxfoundation.org> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220418121145.140991388@linuxfoundation.org> References: <20220418121145.140991388@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Mike Christie [ Upstream commit 06c203a5566beecebb1f8838d026de8a61c8df71 ] If the system is not up, we can just fail immediately since iscsid is not going to ever answer our netlink events. We are already setting the recovery_tmo to 0, but by passing stop_conn STOP_CONN_TERM we never will block the session and start the recovery timer, because for that flag userspace will do the unbind and destroy events which would remove the devices and wake up and kill the eh. Since the conn is dead and the system is going dowm this just has us use STOP_CONN_RECOVER with recovery_tmo=0 so we fail immediately. However, if the user has set the recovery_tmo=-1 we let the system hang like they requested since they might have used that setting for specific reasons (one known reason is for buggy cluster software). Link: https://lore.kernel.org/r/20210525181821.7617-5-michael.christie@oracle.com Signed-off-by: Mike Christie Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin --- drivers/scsi/scsi_transport_iscsi.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c index 6490211b55d2..f93660142e35 100644 --- a/drivers/scsi/scsi_transport_iscsi.c +++ b/drivers/scsi/scsi_transport_iscsi.c @@ -2508,11 +2508,17 @@ static void stop_conn_work_fn(struct work_struct *work) session = iscsi_session_lookup(sid); if (session) { if (system_state != SYSTEM_RUNNING) { - session->recovery_tmo = 0; - iscsi_if_stop_conn(conn, STOP_CONN_TERM); - } else { - iscsi_if_stop_conn(conn, STOP_CONN_RECOVER); + /* + * If the user has set up for the session to + * never timeout then hang like they wanted. + * For all other cases fail right away since + * userspace is not going to relogin. + */ + if (session->recovery_tmo > 0) + session->recovery_tmo = 0; } + + iscsi_if_stop_conn(conn, STOP_CONN_RECOVER); } list_del_init(&conn->conn_list_err); -- 2.35.1