Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2655732pxj; Mon, 14 Jun 2021 04:10:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxinuOb+gvbVExZY5Afr446DpnTNSj72NfGC2fPhDtNfwY6P3qghfCFAF2z/lE3HlfxftL3 X-Received: by 2002:a17:907:2cf6:: with SMTP id hz22mr15259749ejc.320.1623669027367; Mon, 14 Jun 2021 04:10:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623669027; cv=none; d=google.com; s=arc-20160816; b=cooTHYzHAVdGAxL2GR5NpPfTGkpXemb8qyfm/XmBu6zl4AQYM2eRqzpqfcaAGPutZv vl+/QD7wHdp+Wu2vPjSuEP1JtpVjyswibU34YNnAp3tNer/VoZNwDerQlGLg5k8S9jNA 6Lwn2629fkSFv8y3yMoOoHRlOjySSxE9Tct5i8LUH+jBrg8lCffvf/R77cQOg97iIIgv EhIgFV+1rRphDwakzEPgyPxx7ianmUvGiv+QvTJlrPr2sgEoWAPBzNlv4q60QphHlDfy yDc0vzz5FExX23eEoLiLZeMQjWBJMIGptAkvlK0chDiZDJZuoB2dKMZF5ZzlCCoRm/jT 0kNw== 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=xm2JFdixmxeEcjaPgVbFw6iYIMSwnv4A9qfcQMU4ie4=; b=y0YipGti9ezFz//iPCXNtDYO9dqXZK1gbu0rJRqOpVsuwrAIB8ER1mvXcVZ//++gUu /F2soNS/R+NkRrw8gqoweK7tbiIZ1dq07WOmkkhsgosHGQxwGivEHepAt35GIFtZtuAs 1sJQA3npIIlsvJlf8Wjp5e4xI8X1WnzA6GstG7lD4zOkjWxzMVUdEWMNp77AmYTrH8J7 LlcKEv0NTQlOIZYrZ5XJ6GQgqMPt6f2udIfDqFVxXo3tqLrsyp1iIAr7D8EcnTWamNSN CPJ0V62rh21xNM3GxfL48RJNxaMUdvluperJF57E/7XLNl3P4nFQXu1JRj8dkRKe0d5R NrVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ZQ3xDdHA; 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 a25si6069423edr.240.2021.06.14.04.10.05; Mon, 14 Jun 2021 04:10:27 -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=ZQ3xDdHA; 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 S235405AbhFNLKD (ORCPT + 99 others); Mon, 14 Jun 2021 07:10:03 -0400 Received: from mail.kernel.org ([198.145.29.99]:36694 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234755AbhFNK7I (ORCPT ); Mon, 14 Jun 2021 06:59:08 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 591BD6142B; Mon, 14 Jun 2021 10:42:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1623667331; bh=4CVml7otjDJGwBs2cMscAqEdXLLanjVXMjd5sFkOvo0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZQ3xDdHAJ0dWa1VxArTcbI0OicLrEe8pKYhh2iY7S6lmynhlcx6XAHD86QAiiPHOF MDZYWj+c+A+bzTJC5VrFkkTdGGZTsiQSZip38Ar/YfGVh8Aok5OP/VQOlikf9CvfPX B4bXmB+mI8ko8NpvfUoSsCW2Nk2M9AXqLKc2gHN8= 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.10 029/131] scsi: target: qla2xxx: Wait for stop_phase1 at WWN removal Date: Mon, 14 Jun 2021 12:26:30 +0200 Message-Id: <20210614102653.999205807@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210614102652.964395392@linuxfoundation.org> References: <20210614102652.964395392@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 dcae8f071c35..8d4976725a75 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