From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796384279; b=It/hRjOH4Pxo2DK1K6yvlfM/gswT1/ju/vEc0rvwO2sqt0x6kQW5TLaiq07Z9BUlzKEH m3jyRHkzhO6rypiGtnRhEKVwOsChBQDgoeUWrMsKOIDzaAzEHG8U2dWRnMaFVHHtHP6Lf Cpd0gcDbq1Vjw4c5BZiFpPVkF5cJkvCeRIQ+9No2gVWDHuZhryAi43SGBoeF5H4vjWwmH EH6i0F9B1Ay7jmpLVDSjE3kfaedUDprM+IXzbE67fa1EmN+/EDxoVZUW+1GBpEYto5ZWW e7nb+hSL3UY4ke3lM7kalACgH1uxWN117gm7mTWxIyTE8HJE4xuyS9ubO7ZVSoMa7RQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796384279; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=QNWh5KdZ6IzeP9E/pgJMNX3r70nUWTF4zzNUzHQZsys=; b=OSXyjY0K+YrsIv6CPpQo/iT+NEkyysuwr035OW/2cqth8RTNOV9Aw944mKAnAZhqv3vL jr6/jSdZoO2amLD5LnCAXii0Riuo1R+Ewkt2IORt+junwLjRCYtr7y5Ykc7djG8JvsihJ +NbSm81EPOuUj+0UzjgbZYn5A0XBd7nut+qEpeMIwc89CB/RkQSPu4vzHOBj53QpkSRGf 9yRPYyDN3Bh77DMbFJU2xJ3tTC0P3skyBBn6QzEBu37vBAeHIttlzN1WyPazCodwA1Noc ZjCzAxxt5mvb2l6+l9Nrdzj/IUTAs68OJK9xrUmqO7qPo8pwZX/jCm8H+E1GIQ7wdQA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=Tc9cpkTO; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 09B54606A33D; Fri, 4 Dec 2026 11:37:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=Tc9cpkTO Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6CDD31F00897; Fri, 4 Dec 2026 11:37:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796384278; bh=QNWh5KdZ6IzeP9E/pgJMNX3r70nUWTF4zzNUzHQZsys=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=Tc9cpkTOp1B7ppxCdT3cWiMY7BvrOAoK86+eyUtGjuIhTqRiGYD90k/XsFLtlnZ4r /CjlkumAtfZ0bHysDKl2C8LCreu6hPoD8li3dPPL1ay8xQhUatTm0Bqk1skCQvFHnP FyNs6DnWsn7B0qhhER4GCuskhsd649oSlZdg/xPE= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Igor Pylypiv , Niklas Cassel , Sasha Levin Subject: [PATCH 6.6 0084/1167] ata: libata-sata: allow re-enabling NCQ with the same queue_depth Date: Fri, 4 Dec 2026 18:51:51 +0900 Message-ID: <20261204100704.276790752@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100702.047403948@linuxfoundation.org> References: <20261204100702.047403948@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Igor Pylypiv [ Upstream commit d7c5cc8cc21c1264cce07feb4a51be158688280e ] When ata_eh_speed_down() disables NCQ due to excessive errors, it sets ATA_DFLAG_NCQ_OFF without changing sdev->queue_depth. Userspace can re-enable NCQ by writing a queue depth > 1 to the sysfs queue_depth attribute, which invokes ata_change_queue_depth() to clear ATA_DFLAG_NCQ_OFF. However, ata_change_queue_depth() returns early if the requested queue_depth is equal to sdev->queue_depth before clearing ATA_DFLAG_NCQ_OFF. As a result, writing a different queue depth > 1 re-enables NCQ, whereas writing the current sdev->queue_depth value leaves ATA_DFLAG_NCQ_OFF set. Since ata_change_queue_depth() already checks whether queue_depth equals sdev->queue_depth before calling scsi_change_queue_depth(), remove the early check so that writing the current queue_depth > 1 clears ATA_DFLAG_NCQ_OFF and re-enables NCQ. Fixes: 45623d33bfc0 ("ata: libata-sata: Improve ata_change_queue_depth()") Signed-off-by: Igor Pylypiv Reviewed-by: Niklas Cassel Link: https://lore.kernel.org/r/20261029184445.1615717-1-ipylypiv@google.com Signed-off-by: Niklas Cassel Signed-off-by: Sasha Levin --- drivers/ata/libata-sata.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/ata/libata-sata.c b/drivers/ata/libata-sata.c index 9e0a820d6961d..bb796ce0b456c 100644 --- a/drivers/ata/libata-sata.c +++ b/drivers/ata/libata-sata.c @@ -1067,7 +1067,7 @@ int ata_change_queue_depth(struct ata_port *ap, struct scsi_device *sdev, spin_lock_irqsave(ap->lock, flags); dev = ata_scsi_find_dev(ap, sdev); - if (!dev || queue_depth < 1 || queue_depth == sdev->queue_depth) { + if (!dev || queue_depth < 1) { spin_unlock_irqrestore(ap->lock, flags); return sdev->queue_depth; } -- 2.53.0