Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp2915775rwb; Mon, 15 Aug 2022 14:00:31 -0700 (PDT) X-Google-Smtp-Source: AA6agR65qcwO9ZnbK+ziBW+OBe19bTow9OYWKew5MJ5D5lmuowy5rLXMHxTd4p5bGC3C/A1fAaYX X-Received: by 2002:a17:902:e947:b0:170:d739:8cbe with SMTP id b7-20020a170902e94700b00170d7398cbemr19332657pll.141.1660597231653; Mon, 15 Aug 2022 14:00:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660597231; cv=none; d=google.com; s=arc-20160816; b=0t+0EZT4IP3MRbWTNlli7rdod5OscQQHl0hXl6/gOVVd5bfy8l5en6T2VVwMaeSWrY Wp8FrXzFdwkeksUJKpACfLiyFQUt24wKi4f56MuXrFBC2/cI5lVMHBgp87klFXmgFIxt F06JLm4PUaP+pN85b2q7PlsRqEC3cLZlz8TTF3hB/T2Fb4fr+lKrXa/euh0z5HwzY8p0 tFMb+sltC11BaI0xFNb7onI0J0H4iICEl94nppwbHxe+p16qXVLow0yaBbbSl0UqsBRp 0Wx/GB9mhR/TITjA3YGV93AIKFba6/EmsuI2Deru2PDY6Nzklp6RHSX9NdRplnd3f9D/ xnNA== 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=f399qQcvgZxKzi4ZPZMcTDnMe2MK3607acW4tUbK57w=; b=AMd+veU3l+Fv06YHOKgn8LO7vCI4aA6RofH5bGoyKvVAz5VYFwm/YaKcITAcz0AJ6r jHJNYnt2EGmnrdtC/j2Y+wAk5+/z2DidajwT3qjpHAQRAjh35lyUTaa4rnk1DO9175f/ nG+ZBo4lIbYGF6WF4nOABk14bJzK3WMdbU8RXLzTfkefOjuz8rUqyIGcB8AzJN5/F6xF 9ThQMd6KWcpIndFr9KpUUwIxKiktpcBw0Vg9gyftcsf2OCrNaW9q3sidDFMQ2OXxOn62 F/AvvLKHeFjAzJz8gECwGnydxo2UqW6MRweQPR2fA7XMiSDrqKqOKJE9nDrHpLhzwBlV 9x9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=IVUlc8fl; 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 bd32-20020a056a0027a000b0052f9dd05116si1508142pfb.171.2022.08.15.14.00.20; Mon, 15 Aug 2022 14:00:31 -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=IVUlc8fl; 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 S232280AbiHOTMN (ORCPT + 99 others); Mon, 15 Aug 2022 15:12:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44370 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245713AbiHOTID (ORCPT ); Mon, 15 Aug 2022 15:08:03 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 851ED101EF; Mon, 15 Aug 2022 11:35:36 -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 B1B9360FFD; Mon, 15 Aug 2022 18:35:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AB0A4C433C1; Mon, 15 Aug 2022 18:35:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588535; bh=F95PSIpBk6avvNgsm9Kq89di+aGOxNqnEsA06KSo27c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IVUlc8fl8YoVehIDzBW58z3wE2Xxj9NY3UkC/OyLFdP19xsTy8m7GMNx16HVkyB29 EPwulJz6jxqaSQ2eJInWcLx9EOhq93Wb9HVsmxKhBHZ351Zhy7eA+OZyOzBx6BAO7E s5JpnoisnOkUG5mDjurHSRxOkFAMPgj5k6vdA10Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nilesh Javali , Mike Christie , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.15 435/779] scsi: iscsi: Allow iscsi_if_stop_conn() to be called from kernel Date: Mon, 15 Aug 2022 20:01:19 +0200 Message-Id: <20220815180355.880296578@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 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 3328333b47f4163504267440ec0a36087a407a5f ] iscsi_if_stop_conn() is only called from the userspace interface but in a subsequent commit we will want to call it from the kernel interface to allow drivers like qedi to remove sessions from inside the kernel during shutdown. This removes the iscsi_uevent code from iscsi_if_stop_conn() so we can call it in a new helper. Link: https://lore.kernel.org/r/20220616222738.5722-3-michael.christie@oracle.com Tested-by: Nilesh Javali Reviewed-by: Nilesh Javali Signed-off-by: Mike Christie Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin --- drivers/scsi/scsi_transport_iscsi.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c index 5947b9d5746e..671a03b80c30 100644 --- a/drivers/scsi/scsi_transport_iscsi.c +++ b/drivers/scsi/scsi_transport_iscsi.c @@ -2283,16 +2283,8 @@ static void iscsi_if_disconnect_bound_ep(struct iscsi_cls_conn *conn, } } -static int iscsi_if_stop_conn(struct iscsi_transport *transport, - struct iscsi_uevent *ev) +static int iscsi_if_stop_conn(struct iscsi_cls_conn *conn, int flag) { - int flag = ev->u.stop_conn.flag; - struct iscsi_cls_conn *conn; - - conn = iscsi_conn_lookup(ev->u.stop_conn.sid, ev->u.stop_conn.cid); - if (!conn) - return -EINVAL; - ISCSI_DBG_TRANS_CONN(conn, "iscsi if conn stop.\n"); /* * If this is a termination we have to call stop_conn with that flag @@ -3739,7 +3731,12 @@ static int iscsi_if_transport_conn(struct iscsi_transport *transport, case ISCSI_UEVENT_DESTROY_CONN: return iscsi_if_destroy_conn(transport, ev); case ISCSI_UEVENT_STOP_CONN: - return iscsi_if_stop_conn(transport, ev); + conn = iscsi_conn_lookup(ev->u.stop_conn.sid, + ev->u.stop_conn.cid); + if (!conn) + return -EINVAL; + + return iscsi_if_stop_conn(conn, ev->u.stop_conn.flag); } /* -- 2.35.1