From nobody Sun Jun 14 08:34:20 2026 Received: from mail-pf1-f202.google.com (mail-pf1-f202.google.com [209.85.210.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C8FBD35F18B for ; Thu, 2 Apr 2026 16:07:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.202 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775146033; cv=none; b=JULXRnAnY62k3l32CR5JRAbdObrjvypowu38VjCsUFM1rpBZh9dMAkIc71UhtRg7cYy4Yw5nVAIxi7yX3OTDGFCnJ36v0p2ndMuSdP99xrZNidYzWYKjs6vX1MsQIetnGY+wKzAk/lMWU4A5P571GRaSMsTbKICE/e6RudG4BBA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775146033; c=relaxed/simple; bh=lJJPLiWQ88hF2omeXe9q0oHz1xITYMdJjEh/PkMHz9g=; h=Date:Mime-Version:Message-ID:Subject:From:To:Cc:Content-Type; b=RyXxcskFo+EBVt0gPDrpQe++SQIRkcdusiTfyGuNDMHPiq+eNhbJNrNaYV0M8UmUZ+N5vxxAuqaj20Hlh4NZAjaMe2KmGyfOQQAZu367ori+2bg5zgufNED8g9QoZVGWuEF9ZHckEUGQE56Ns7f30rnsOLQXdAHYFVdBxr4HKYo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--ipylypiv.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=cwNkSHHk; arc=none smtp.client-ip=209.85.210.202 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--ipylypiv.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="cwNkSHHk" Received: by mail-pf1-f202.google.com with SMTP id d2e1a72fcca58-82ca8323edbso1317799b3a.1 for ; Thu, 02 Apr 2026 09:07:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1775146032; x=1775750832; darn=vger.kernel.org; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=tY3YLUnv7koH8w7vvcawAH8VEOQcI6MwE/0pyNwOOEs=; b=cwNkSHHkfR2PXzTY1UzL3bd5t/LBbLpzY90auNll4hsDSVVS1jHOM9hb4YXVnVpBxg zQpxvtWpKQHV+j9VGD9Yff0D/PGNdM4jlbRMPgE2MvNRgKN/qVZOoeLd9j0uCbISrbRZ PNbEFgawfOh9wiqXUspJpjf1euf3zHjFY0SZKuEBefqA6tOTGTEbeeDIq0bNL95UPZFl zDzMctfnvUd9we35jHEjTyQG7ZKMe5414xTnzrjBvbLl1vIK2RaKDDAPfNnhLyvqcg0T 5bZdmpuCbtO84eCMs0/NvbmfG00ErFMcIdpJxmRlP6Ax7zQXpwF7JRvjQ96QD5Bgw8J2 zeaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775146032; x=1775750832; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=tY3YLUnv7koH8w7vvcawAH8VEOQcI6MwE/0pyNwOOEs=; b=QnLUUKneDau2lJ3vvOkawws5dzm23mCVCGwUdNs8S9n15rv73vHYE6v0fp2e9jilma UvhntB2F5DNfvjoz8RgtT2/epMk5ZtQvzQPYYe6KQo+fqUgZcy+r8I/zLPm/FgrP6pxD eO0jwaOcBZ86l3ltsYabJuDmHpnT399jKvUCj4zPQsM1x1Etu6rAvitdjP/fjr82Sapo MNhXQtjmZ1Y1VRhJLurhZqyfrH26IqDCRj+LfkwMcm8ivF4DH+appHPvE773efDGU/ki 0tIfpAM/PyJn1VotpkUIoXiKRdbaWaKQNpAynO2oHHKF7CmehMoE22DsQ+BEstLORWJ/ uGeQ== X-Forwarded-Encrypted: i=1; AJvYcCUpdQ172F+XhBD+sSS3C0rumKdTNG5E0EGs+zLDcUw2aSGii6XgnY24GVOqUZ0O45x2v25syWJHE5iVzbo=@vger.kernel.org X-Gm-Message-State: AOJu0YwPTSzLxdKr1P3pq0keF9FsozW3oGqA0+qni9W4vqOOJFuWSep1 FaPgOLeSMnybz2t//0RWZ478opRrjEtGEbBwfiBlz+JbTRIqlqf6f6vK6kHhL9TgN4efKLAL1DU XmWTsu0RHmWKfuQ== X-Received: from pfbhw14.prod.google.com ([2002:a05:6a00:890e:b0:82a:ff5:27be]) (user=ipylypiv job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6a00:1888:b0:81f:3fa0:8c38 with SMTP id d2e1a72fcca58-82ce8957dd1mr9088627b3a.20.1775146029269; Thu, 02 Apr 2026 09:07:09 -0700 (PDT) Date: Thu, 2 Apr 2026 09:07:05 -0700 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 X-Mailer: git-send-email 2.53.0.1185.g05d4b7b318-goog Message-ID: <20260402160705.1033273-1-ipylypiv@google.com> Subject: [PATCH v2] ata: libata-eh: Do not retry reset if the device is gone From: Igor Pylypiv To: Damien Le Moal , Niklas Cassel Cc: linux-ide@vger.kernel.org, linux-kernel@vger.kernel.org, Igor Pylypiv Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" If a device is hot-unplugged or otherwise disappears during error handling, ata_eh_reset() may fail with -ENODEV. Currently, the error handler will continue to retry the reset operation up to max_tries times. Prevent unnecessary reset retries by exiting the loop early when ata_do_reset() returns -ENODEV. Reviewed-by: Damien Le Moal Signed-off-by: Igor Pylypiv --- Changes from v1: - Corrected the commit message to reference ata_do_reset() instead of ata_eh_reset() for the early loop break. drivers/ata/libata-eh.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c index 23be85418b3b..e97a842005e9 100644 --- a/drivers/ata/libata-eh.c +++ b/drivers/ata/libata-eh.c @@ -3171,7 +3171,7 @@ int ata_eh_reset(struct ata_link *link, int classify, sata_scr_read(link, SCR_STATUS, &sstatus)) rc =3D -ERESTART; =20 - if (try >=3D max_tries) { + if (try >=3D max_tries || rc =3D=3D -ENODEV) { /* * Thaw host port even if reset failed, so that the port * can be retried on the next phy event. This risks --=20 2.53.0.1185.g05d4b7b318-goog