Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2271405pxb; Fri, 5 Feb 2021 13:23:59 -0800 (PST) X-Google-Smtp-Source: ABdhPJy/lr2rbkg2/29xvicFi0FH90aOYnBRIUo988rWs/a3YtByJh+g4ILwt9FP6ee/m7uHxE7s X-Received: by 2002:a17:906:ada:: with SMTP id z26mr5829208ejf.218.1612560239527; Fri, 05 Feb 2021 13:23:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612560239; cv=none; d=google.com; s=arc-20160816; b=zny5S2yqE95Rv6itxYaYJZIQC/5X4K+bC4iYEFZD1XZZegYhmeauu7I5j1j/WJVoHr tHbB2aQ/z1XZC1hzVvsVTt6RiMs59OwkGV0hIBQiAcXXpNTZ+qv428OcvwWVbvGZLSoz E6Lx21O1E51N0nnL0ojeLVh1uaaBs3IHdGsDeisRKRrhGHEi5XcZSKALLZYOjHXHocIV nVWuTK1noyBjop3+uia9bkXBxImnyoC2UssLchdP2n23NCCPqd5jSX+1ab5dVRCZtg26 +rjNT/T/xadOFDgqMpSiOYtUqcEPjgZ75u7tGI5j8QilIAtEYy+fy6cOw7c+EaMzb/Vg WzsA== 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=r7oyataT0L1/EblTAT8Koj0bmcEGkolzKPXaaZMvJKA=; b=0MUpryef3urTEGq6iyn+QA5Cq2haDkueqjp5lIC7CHNU2hHxujQCJctIwXyFJZYrJ8 +sh6X3EhM3PEYRrm+CTuXhr2975vjXImJh/TL4Wmq5mwIbOaVXZIG55C+k4bF1ghqblh PXoMXUyzT8h26MU3JgkJUQ2RUhgQM6+u2JfjiNDhcy9W45TQYjXTuUTxbXgS5/LDXaNe j72sqCswM3O0XAr5qQ3OJs4oBnNOtKQh1aC32DVHE2IPBRXswxnH7g379vyW8mtMl/QT qXrwA3Q43eYbcxyIxHxiDTPh8GfkCJVEwSX0yCXgDOp8eNSivsZxud0UaRjqUqQCxUkc siOQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=V0naG4fV; 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 u13si5832642edp.96.2021.02.05.13.23.35; Fri, 05 Feb 2021 13:23:59 -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=V0naG4fV; 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 S233729AbhBEVUn (ORCPT + 99 others); Fri, 5 Feb 2021 16:20:43 -0500 Received: from mail.kernel.org ([198.145.29.99]:45950 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233065AbhBEPCS (ORCPT ); Fri, 5 Feb 2021 10:02:18 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 91E8A65074; Fri, 5 Feb 2021 14:13:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1612534386; bh=bfsyji7DedJHGfGCvnof8We/7zg6zZ/EXeV5V/r3SC4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=V0naG4fV+oAe4qhTOV5EMVpHsYLgYbmfqrUUrSKABcA/x5Z/pV+Sbtk6J8oGejM0B /aJZddG6rvFypmAxtNNfj9pSa//UVgEyV0C5z3d6YkmPNjFsWd+5QYhyv6HrNwyOmE BHxjPuMNiXFLjazemSf7yxHFiol5I9ndq8esmiHU= 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.4 18/32] scsi: scsi_transport_srp: Dont block target in failfast state Date: Fri, 5 Feb 2021 15:07:33 +0100 Message-Id: <20210205140653.119183435@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210205140652.348864025@linuxfoundation.org> References: <20210205140652.348864025@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 d4d1104fac991..8cd0a87764dfd 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