From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7ECE21946C7; Wed, 5 Mar 2025 17:50:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741197057; cv=none; b=NwQ6u6a03MR4mbHZc74KC8xsFMAXdNBtSvJJDUbtT/S/FUk3S78uyl+obgYmR23KBSYqd39m6HL6wrLW4rLZVcMSo0Ae/F+4Sd0isOQm93Pe0sxW8kXiK6pZ2G2EQvqCtVI8/PhM8NXxjiWPhZBqsI7LiBGDbxGtGDVYUWU9J28= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741197057; c=relaxed/simple; bh=jZz6Ofmk6H0mHfGWMkN+AXwsmKIlDHLLofYTUtBJZwk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=MQfDn+0yHD5onKWUd6IE4WN1+iHnkLFS/gtWqzajpnDaIesto4kcb/tftO4BZHJN3CzwokvfrGNz6RZj6uM9XBfa5us5Ak08zdVdvNi2ZTr6qtPfsRtJ2QOc88MaU6tkVxNP/T6kVtL188BSVHqa3WRmaXc8BHWnKGuSkUB2kM4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=kjr6Tzyp; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="kjr6Tzyp" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 079CFC4CED1; Wed, 5 Mar 2025 17:50:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1741197057; bh=jZz6Ofmk6H0mHfGWMkN+AXwsmKIlDHLLofYTUtBJZwk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kjr6TzypDUjEt8NeF0VTHk50f2F3bW7b3THbcinqZjBvYYCFCxCbbRvDGj6rQkQLe E2a1zisYVpVqwuYGyLDzO/OYsZb4/ByxgcBleOa0SpW97ZTus5Pl6jyRIS+037Az7i ziNOg2I+ResPEwW8X6Xy4Uiv8D00Qa89zs4657Pw= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Igor Pylypiv , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 6.1 024/176] scsi: core: Do not retry I/Os during depopulation Date: Wed, 5 Mar 2025 18:46:33 +0100 Message-ID: <20250305174506.430624024@linuxfoundation.org> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250305174505.437358097@linuxfoundation.org> References: <20250305174505.437358097@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Igor Pylypiv [ Upstream commit 9ff7c383b8ac0c482a1da7989f703406d78445c6 ] Fail I/Os instead of retry to prevent user space processes from being blocked on the I/O completion for several minutes. Retrying I/Os during "depopulation in progress" or "depopulation restore in progress" results in a continuous retry loop until the depopulation completes or until the I/O retry loop is aborted due to a timeout by the scsi_cmd_runtime_exceeced(). Depopulation is slow and can take 24+ hours to complete on 20+ TB HDDs. Most I/Os in the depopulation retry loop end up taking several minutes before returning the failure to user space. Cc: stable@vger.kernel.org # 4.18.x: 2bbeb8d scsi: core: Handle depopulation and restoration in progress Cc: stable@vger.kernel.org # 4.18.x Fixes: e37c7d9a0341 ("scsi: core: sanitize++ in progress") Signed-off-by: Igor Pylypiv Link: https://lore.kernel.org/r/20250131184408.859579-1-ipylypiv@google.com Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin --- drivers/scsi/scsi_lib.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index b8d58120badde..72d31b2267ef4 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -782,13 +782,18 @@ static void scsi_io_completion_action(struct scsi_cmnd *cmd, int result) case 0x1a: /* start stop unit in progress */ case 0x1b: /* sanitize in progress */ case 0x1d: /* configuration in progress */ - case 0x24: /* depopulation in progress */ - case 0x25: /* depopulation restore in progress */ action = ACTION_DELAYED_RETRY; break; case 0x0a: /* ALUA state transition */ action = ACTION_DELAYED_REPREP; break; + /* + * Depopulation might take many hours, + * thus it is not worthwhile to retry. + */ + case 0x24: /* depopulation in progress */ + case 0x25: /* depopulation restore in progress */ + fallthrough; default: action = ACTION_FAIL; break; -- 2.39.5