Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2306267pxb; Fri, 5 Feb 2021 14:31:54 -0800 (PST) X-Google-Smtp-Source: ABdhPJweYS+bUWli5LSPdQM/kyUgY78vJPXPNKAdutSmVJPZgKnQ9Xuz3KbRNz/9AqKcy1N1vPrv X-Received: by 2002:a05:6402:270e:: with SMTP id y14mr5655835edd.322.1612564313913; Fri, 05 Feb 2021 14:31:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612564313; cv=none; d=google.com; s=arc-20160816; b=eOdAArix++H+Nf1Ov2T4EcTmT/XTfzNyVC2yJb+RN2tl7Z7UVp3dB0sLq0ZAuIGyk+ jbUxgKrVoaf345NYbs6MHPC1ziLHlvnvwEcDCXUZlt2E9anmFEpYeEuZZ4srQAI2jOPq x27XQaucs77WYVPXhAk3Ks1xROPM+cUlProwckU6t5OkUzzDIwZWTf6CIfiobD6bydpO jLtrIy7VLxTuN1J8A1WVWUuEcPLfktvdfzqdYUqcR6+AKFEsIrX0bnJKW0d0hnCpp0Nj LUrgaIxvjUmPU6gakVQgqvbBQu0Nl+9prUalMv3dtNmnBr95tf6xmczzYGZFLsXnY2MO zPTA== 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=2Ah6tC/lZitgpMzgtWm35n35E1NZESx0FS3W6Jd7f6w=; b=Vq/aiJy38D6zrZub4enGE1r1g67mmz8cCHhtmp8vf8b4aTZLNDWXj/z+Cjnu4HG0OV s67CZemFC+R5Cl3uG85a5Q5OAaGQcahnki1WgD3VCdqQ5C2sOhlQCD5S2eyaiB3UJE94 BOYxmdBrgKxU+MBUgxF6SzQjp1+Kbl01FYAjrqefNHkchjPp3ovX/VmgMdp9TtzTnJ+Q q/pSCw6hPXyGoQY8oCKOFa0/+Mc3GBFgQmLQf7ElfPH0b4uT52Vp8Q6uX31jtn6W8I8+ gxJ3xVVOGCLxoRTaiaa5dEMqMvQylAV/hypSs7Siu+TXEP/VVYXXHsymN4sB7LHoF8Ct +k5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=cUFjxNXu; 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 eb13si7361889edb.385.2021.02.05.14.31.29; Fri, 05 Feb 2021 14:31:53 -0800 (PST) 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=cUFjxNXu; 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 S233036AbhBEWau (ORCPT + 99 others); Fri, 5 Feb 2021 17:30:50 -0500 Received: from mail.kernel.org ([198.145.29.99]:44674 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232838AbhBEOyd (ORCPT ); Fri, 5 Feb 2021 09:54:33 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 33ED764FD8; Fri, 5 Feb 2021 14:10:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1612534204; bh=Ei+H++JWsxsFhwx8F/JPvXtBIKGu1bdr15/qIkBKhKw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cUFjxNXuQqxyX50D1UaQXu+7EVHGAlhl4LIOk3EJvTJEUUkAnVEKPLBThvJOozPFq m9QM5cbljbwmgboHnWbS3LLNtP0Nz3AKPm/MZeL76DRfocPjpYGTRr5CIfUaoceqav 3eCw32mBtWt+v1UeyU+qCbiK+8LauRfiMdhXRGd0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bart Van Assche , Martin Wilck , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.10 26/57] scsi: scsi_transport_srp: Dont block target in failfast state Date: Fri, 5 Feb 2021 15:06:52 +0100 Message-Id: <20210205140657.095615015@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210205140655.982616732@linuxfoundation.org> References: <20210205140655.982616732@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: Martin Wilck [ Upstream commit 72eeb7c7151302ef007f1acd018cbf6f30e50321 ] If the port is in SRP_RPORT_FAIL_FAST state when srp_reconnect_rport() is entered, a transition to SDEV_BLOCK would be illegal, and a kernel WARNING would be triggered. Skip scsi_target_block() in this case. Link: https://lore.kernel.org/r/20210111142541.21534-1-mwilck@suse.com Reviewed-by: Bart Van Assche Signed-off-by: Martin Wilck Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin --- drivers/scsi/scsi_transport_srp.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/scsi_transport_srp.c b/drivers/scsi/scsi_transport_srp.c index cba1cf6a1c12d..1e939a2a387f3 100644 --- a/drivers/scsi/scsi_transport_srp.c +++ b/drivers/scsi/scsi_transport_srp.c @@ -541,7 +541,14 @@ int srp_reconnect_rport(struct srp_rport *rport) res = mutex_lock_interruptible(&rport->mutex); if (res) goto out; - scsi_target_block(&shost->shost_gendev); + if (rport->state != SRP_RPORT_FAIL_FAST) + /* + * sdev state must be SDEV_TRANSPORT_OFFLINE, transition + * to SDEV_BLOCK is illegal. Calling scsi_target_unblock() + * later is ok though, scsi_internal_device_unblock_nowait() + * treats SDEV_TRANSPORT_OFFLINE like SDEV_BLOCK. + */ + scsi_target_block(&shost->shost_gendev); res = rport->state != SRP_RPORT_LOST ? i->f->reconnect(rport) : -ENODEV; pr_debug("%s (state %d): transport.reconnect() returned %d\n", dev_name(&shost->shost_gendev), rport->state, res); -- 2.27.0