Skip to content

Commit 6e15369

Browse files
ipylypivgregkh
authored andcommitted
ata: libata-scsi: Fix CDL control
commit 58768b0 upstream. Delete extra checks for the ATA_DFLAG_CDL_ENABLED flag that prevent SET FEATURES command from being issued to a drive when NCQ commands are active. ata_mselect_control_ata_feature() sets / clears the ATA_DFLAG_CDL_ENABLED flag during the translation of MODE SELECT to SET FEATURES. If SET FEATURES gets deferred due to outstanding NCQ commands, the original MODE SELECT command will be re-queued. When the re-queued MODE SELECT goes through the ata_mselect_control_ata_feature() translation again, SET FEATURES will not be issued because ATA_DFLAG_CDL_ENABLED has been already set or cleared by the initial translation of MODE SELECT. The ATA_DFLAG_CDL_ENABLED checks in ata_mselect_control_ata_feature() are safe to remove because scsi_cdl_enable() implements a similar logic that avoids enabling CDL if it has been enabled already. Fixes: 17e897a ("ata: libata-scsi: Improve CDL control") Cc: stable@vger.kernel.org Signed-off-by: Igor Pylypiv <ipylypiv@google.com> Reviewed-by: Niklas Cassel <cassel@kernel.org> Signed-off-by: Damien Le Moal <dlemoal@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 947ee26 commit 6e15369

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

drivers/ata/libata-scsi.c

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3905,21 +3905,16 @@ static int ata_mselect_control_ata_feature(struct ata_queued_cmd *qc,
39053905
/* Check cdl_ctrl */
39063906
switch (buf[0] & 0x03) {
39073907
case 0:
3908-
/* Disable CDL if it is enabled */
3909-
if (!(dev->flags & ATA_DFLAG_CDL_ENABLED))
3910-
return 0;
3908+
/* Disable CDL */
39113909
ata_dev_dbg(dev, "Disabling CDL\n");
39123910
cdl_action = 0;
39133911
dev->flags &= ~ATA_DFLAG_CDL_ENABLED;
39143912
break;
39153913
case 0x02:
39163914
/*
3917-
* Enable CDL if not already enabled. Since this is mutually
3918-
* exclusive with NCQ priority, allow this only if NCQ priority
3919-
* is disabled.
3915+
* Enable CDL. Since CDL is mutually exclusive with NCQ
3916+
* priority, allow this only if NCQ priority is disabled.
39203917
*/
3921-
if (dev->flags & ATA_DFLAG_CDL_ENABLED)
3922-
return 0;
39233918
if (dev->flags & ATA_DFLAG_NCQ_PRIO_ENABLED) {
39243919
ata_dev_err(dev,
39253920
"NCQ priority must be disabled to enable CDL\n");

0 commit comments

Comments
 (0)