Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2648267pxj; Mon, 14 Jun 2021 04:00:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw4sW92kdNN0oi5dWtqWJsGFrzchg6v6bl6b7++4L4dKH/NCDhEhVHJ960r992otMfWCkb5 X-Received: by 2002:a17:907:1b1b:: with SMTP id mp27mr14267464ejc.538.1623668451135; Mon, 14 Jun 2021 04:00:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623668451; cv=none; d=google.com; s=arc-20160816; b=DNHU5HfgQqyTgtN5As0K9LsjIpzF4bzIFsld6Y2Ynig/yqw5EOCrIiwNMRWFomp8ag DnxSPUlM9HeGD7dEXgsWRkWFFiiiTM4KitSY/RlWhvpBXaOOUDs5jUynKnsRDWp4JccB 1N6EsTTisLKNuXPhDXffQq5ojx1K5aT5p8XB5qsO0oWxC2zdm/f1hkib4FdNDbSr2+fN xclxArUfiQSVdsZh/JjwwHIqwGNZBTJPAEJzCSmPCYqdPQ2QAK9dEfXvAt55jOMqvIAl FXH2wYpBv8DX5IfrHNFYzbRu5FZDxx6UPTc0iu4AlIducCEZrXGTFY46NDr5aBeq+9Oz NV6Q== 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=AWzCIfgKayjfgodGoUhg2pMFmu9Go5LltxOldUVNSOo=; b=hHLKLgoXeL5k6aoSCGyjOryK3K/BcVmwcI2Lw56hOW1Yt0kkEXN9YGczsQu0bC1HWq KaHA0g+vAg+JwnVgm8cnB9MbvlnG4YegAka3VIuFOHV96b+utgwP0qLY7IfmlZfjx+0c 85pO22T16AbsdbNhgUdNYQSYUlszhBV2Rl7uqUeWvdqHpAPGQMPiKEJd1Tr84zCyw8wF oriJUGThLm+daq2E9TObayPiu6OoVV1+QlW0IUwK36a1Q2SMqHPJTBKpEm2ezi2Mgq9e Lj1WSVe0aSSiW93p22rfz8MeQooGwYs+n9AUgYFih/YNMYql2kmISks79uqaFs4i4X7H VfiA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=o47qQou0; 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=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bi14si11098351ejb.441.2021.06.14.04.00.26; Mon, 14 Jun 2021 04:00:51 -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=@linuxfoundation.org header.s=korg header.b=o47qQou0; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232898AbhFNK6L (ORCPT + 99 others); Mon, 14 Jun 2021 06:58:11 -0400 Received: from mail.kernel.org ([198.145.29.99]:57768 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233773AbhFNKt5 (ORCPT ); Mon, 14 Jun 2021 06:49:57 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 9094B6141B; Mon, 14 Jun 2021 10:38:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1623667106; bh=WAbIyIEjDgStl+UYWQFKDtS5YlZzSJEiuzQuLw42K7A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=o47qQou0EVsOeUczR2ZjK6GTnPPZp0o0zwqz84nDtVDlBTFwoBXGTzRQd60/E3prK VmpnyI8EmNIJbWHb/sfr9tBFm3VtduFuEjl1RjGL8TK/t6jxJscR5PJBWzZShFv0ow Ht7qVxXKaX+ACpmhQeP08SU5iazZpkQeUEi+fSN0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Roman Bolshakov , Dmitry Bogdanov , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.4 22/84] scsi: target: qla2xxx: Wait for stop_phase1 at WWN removal Date: Mon, 14 Jun 2021 12:27:00 +0200 Message-Id: <20210614102647.116379560@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210614102646.341387537@linuxfoundation.org> References: <20210614102646.341387537@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Dmitry Bogdanov [ Upstream commit 2ef7665dfd88830f15415ba007c7c9a46be7acd8 ] Target de-configuration panics at high CPU load because TPGT and WWPN can be removed on separate threads. TPGT removal requests a reset HBA on a separate thread and waits for reset complete (phase1). Due to high CPU load that HBA reset can be delayed for some time. WWPN removal does qlt_stop_phase2(). There it is believed that phase1 has already completed and thus tgt.tgt_ops is subsequently cleared. However, tgt.tgt_ops is needed to process incoming traffic and therefore this will cause one of the following panics: NIP qlt_reset+0x7c/0x220 [qla2xxx] LR qlt_reset+0x68/0x220 [qla2xxx] Call Trace: 0xc000003ffff63a78 (unreliable) qlt_handle_imm_notify+0x800/0x10c0 [qla2xxx] qlt_24xx_atio_pkt+0x208/0x590 [qla2xxx] qlt_24xx_process_atio_queue+0x33c/0x7a0 [qla2xxx] qla83xx_msix_atio_q+0x54/0x90 [qla2xxx] or NIP qlt_24xx_handle_abts+0xd0/0x2a0 [qla2xxx] LR qlt_24xx_handle_abts+0xb4/0x2a0 [qla2xxx] Call Trace: qlt_24xx_handle_abts+0x90/0x2a0 [qla2xxx] (unreliable) qlt_24xx_process_atio_queue+0x500/0x7a0 [qla2xxx] qla83xx_msix_atio_q+0x54/0x90 [qla2xxx] or NIP qlt_create_sess+0x90/0x4e0 [qla2xxx] LR qla24xx_do_nack_work+0xa8/0x180 [qla2xxx] Call Trace: 0xc0000000348fba30 (unreliable) qla24xx_do_nack_work+0xa8/0x180 [qla2xxx] qla2x00_do_work+0x674/0xbf0 [qla2xxx] qla2x00_iocb_work_fn The patch fixes the issue by serializing qlt_stop_phase1() and qlt_stop_phase2() functions to make WWPN removal wait for phase1 completion. Link: https://lore.kernel.org/r/20210415203554.27890-1-d.bogdanov@yadro.com Reviewed-by: Roman Bolshakov Signed-off-by: Dmitry Bogdanov Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin --- drivers/scsi/qla2xxx/qla_target.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c index 509539ec58e9..57068e2faef5 100644 --- a/drivers/scsi/qla2xxx/qla_target.c +++ b/drivers/scsi/qla2xxx/qla_target.c @@ -1559,10 +1559,12 @@ void qlt_stop_phase2(struct qla_tgt *tgt) return; } + mutex_lock(&tgt->ha->optrom_mutex); mutex_lock(&vha->vha_tgt.tgt_mutex); tgt->tgt_stop = 0; tgt->tgt_stopped = 1; mutex_unlock(&vha->vha_tgt.tgt_mutex); + mutex_unlock(&tgt->ha->optrom_mutex); ql_dbg(ql_dbg_tgt_mgt, vha, 0xf00c, "Stop of tgt %p finished\n", tgt); -- 2.30.2