Received: by 2002:a05:6602:2086:0:0:0:0 with SMTP id a6csp3651189ioa; Tue, 26 Apr 2022 07:33:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzAYO36FLTpuDkrZkgX02lJao+61/obzckSTd2wfiVga9YAMBGkOu5pMfLCxJFHKX+01L60 X-Received: by 2002:a17:90b:1e08:b0:1d2:8bb4:f565 with SMTP id pg8-20020a17090b1e0800b001d28bb4f565mr37830921pjb.4.1650983624636; Tue, 26 Apr 2022 07:33:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650983624; cv=none; d=google.com; s=arc-20160816; b=i8cQ9e1oI5YTXTmf8CVT1BToyTGxPjjAIn4DT36kn+pvZFjh5NwrA5fIGDJAczKWdw 3yavDjhjlHfH+I2pvne22CQIEaJJpLP1s2vA+TIB5Vt4HJuI/iATDrc/4jvIwl/G2SDC UySsFcNyUBbzWqnjdF3JM6Ud7zx9ifMOIVs8Opa5Yl7Yp3B92zc9er3eycfjcRz/bwqk bYD9CI9IzFdZuq+olHu9iD6WsJ+IXd9UnFcPCZOCdNmlig/1J6eCKi7bCeEBr9ZQCA59 RB9MTA/DmnuVnYH2sB24FvSw2cPW/DXafROYPWV9c1uZTK8L1Zwk0IJIJbNgoOt80hRk UZjg== 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=4OnVzp7nFpvyhtJupIDIMmmsFtBYc6aWbxYWRG10yF4=; b=UYZWac8mJI3rzbTIzZMgVeTjNeDbW6zno+ASNwADJh9D+iNDqr7ocpQ0VjJnKyCsZm F1+mIiG/upOnbf9B+BEefBniU2duFtVHE0D3bVS74oLjPYLeSfInFFzdncqDDLJL2qsL OdFvFPihnSrneayDZ3mxwLFyol/Gu41nIzzFf6K98z9Z9uAvaVgoxk1N7DHVlHTcYsOH UrzwFpkv7OuOU/lsmpY2n1z8CK9CWTdNqGwQFO5Gu/LEk+QB7S9CPsRA5f9r6iB8ZzYT E99OYFwb7ag/2EH47EiTpHXk4oj+5jheJPCxAHggAXMvth3LALgHjiFqzMGloO9HhCAY SDCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=fCeSLxDs; 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 bv17-20020a17090af19100b001d29340d056si2479649pjb.44.2022.04.26.07.33.26; Tue, 26 Apr 2022 07:33:44 -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=fCeSLxDs; 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 S1348075AbiDZJPJ (ORCPT + 99 others); Tue, 26 Apr 2022 05:15:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52190 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347049AbiDZIvB (ORCPT ); Tue, 26 Apr 2022 04:51:01 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F021C1738CA; Tue, 26 Apr 2022 01:39:25 -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 504116090C; Tue, 26 Apr 2022 08:39:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5FCFEC385A0; Tue, 26 Apr 2022 08:39:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1650962364; bh=JQxcb8I4zW0fNZWM3VRNh61ptw73ZrM7m53hpGMdlrA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fCeSLxDsmVgAcUWtvYwEPQ9V/SF/d4E/6Xk+1gA1rdW0sBgJbGeAy1X/iVHa8fqur gpEiIFcJ3Qa/dElOCUVlsPdt9nIkScya+pStNwSuwfVgZLKLWZZVG4O5ATbW3Huj51 rxLvtyKxR9iRl0hfsw+Wm18aWp5uYhPqd8NSjb+U= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Manish Rangankar , Lee Duncan , Chris Leech , Mike Christie , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.15 070/124] scsi: iscsi: Fix NOP handling during conn recovery Date: Tue, 26 Apr 2022 10:21:11 +0200 Message-Id: <20220426081749.291563079@linuxfoundation.org> X-Mailer: git-send-email 2.36.0 In-Reply-To: <20220426081747.286685339@linuxfoundation.org> References: <20220426081747.286685339@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 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 44ac97109e42f87b1a34954704b81b6c8eca80c4 ] If a offload driver doesn't use the xmit workqueue, then when we are doing ep_disconnect libiscsi can still inject PDUs to the driver. This adds a check for if the connection is bound before trying to inject PDUs. Link: https://lore.kernel.org/r/20220408001314.5014-9-michael.christie@oracle.com Tested-by: Manish Rangankar Reviewed-by: Lee Duncan Reviewed-by: Chris Leech Signed-off-by: Mike Christie Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin --- drivers/scsi/libiscsi.c | 7 ++++++- include/scsi/libiscsi.h | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c index a4f26431b033..0f2c7098f9d6 100644 --- a/drivers/scsi/libiscsi.c +++ b/drivers/scsi/libiscsi.c @@ -678,7 +678,8 @@ __iscsi_conn_send_pdu(struct iscsi_conn *conn, struct iscsi_hdr *hdr, struct iscsi_task *task; itt_t itt; - if (session->state == ISCSI_STATE_TERMINATE) + if (session->state == ISCSI_STATE_TERMINATE || + !test_bit(ISCSI_CONN_FLAG_BOUND, &conn->flags)) return NULL; if (opcode == ISCSI_OP_LOGIN || opcode == ISCSI_OP_TEXT) { @@ -2214,6 +2215,8 @@ void iscsi_conn_unbind(struct iscsi_cls_conn *cls_conn, bool is_active) iscsi_suspend_tx(conn); spin_lock_bh(&session->frwd_lock); + clear_bit(ISCSI_CONN_FLAG_BOUND, &conn->flags); + if (!is_active) { /* * if logout timed out before userspace could even send a PDU @@ -3312,6 +3315,8 @@ int iscsi_conn_bind(struct iscsi_cls_session *cls_session, spin_lock_bh(&session->frwd_lock); if (is_leading) session->leadconn = conn; + + set_bit(ISCSI_CONN_FLAG_BOUND, &conn->flags); spin_unlock_bh(&session->frwd_lock); /* diff --git a/include/scsi/libiscsi.h b/include/scsi/libiscsi.h index bdb0ae11682d..d1e282f0d6f1 100644 --- a/include/scsi/libiscsi.h +++ b/include/scsi/libiscsi.h @@ -55,7 +55,7 @@ enum { /* Connection flags */ #define ISCSI_CONN_FLAG_SUSPEND_TX BIT(0) #define ISCSI_CONN_FLAG_SUSPEND_RX BIT(1) - +#define ISCSI_CONN_FLAG_BOUND BIT(2) #define ISCSI_ITT_MASK 0x1fff #define ISCSI_TOTAL_CMDS_MAX 4096 -- 2.35.1