Skip to content

Commit 58768b0

Browse files
ipylypivdamien-lemoal
authored andcommitted
ata: libata-scsi: Fix CDL control
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: [email protected] Signed-off-by: Igor Pylypiv <[email protected]> Reviewed-by: Niklas Cassel <[email protected]> Signed-off-by: Damien Le Moal <[email protected]>
1 parent 35f6bed commit 58768b0

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
@@ -3904,21 +3904,16 @@ static int ata_mselect_control_ata_feature(struct ata_queued_cmd *qc,
39043904
/* Check cdl_ctrl */
39053905
switch (buf[0] & 0x03) {
39063906
case 0:
3907-
/* Disable CDL if it is enabled */
3908-
if (!(dev->flags & ATA_DFLAG_CDL_ENABLED))
3909-
return 0;
3907+
/* Disable CDL */
39103908
ata_dev_dbg(dev, "Disabling CDL\n");
39113909
cdl_action = 0;
39123910
dev->flags &= ~ATA_DFLAG_CDL_ENABLED;
39133911
break;
39143912
case 0x02:
39153913
/*
3916-
* Enable CDL if not already enabled. Since this is mutually
3917-
* exclusive with NCQ priority, allow this only if NCQ priority
3918-
* is disabled.
3914+
* Enable CDL. Since CDL is mutually exclusive with NCQ
3915+
* priority, allow this only if NCQ priority is disabled.
39193916
*/
3920-
if (dev->flags & ATA_DFLAG_CDL_ENABLED)
3921-
return 0;
39223917
if (dev->flags & ATA_DFLAG_NCQ_PRIO_ENABLED) {
39233918
ata_dev_err(dev,
39243919
"NCQ priority must be disabled to enable CDL\n");

0 commit comments

Comments
 (0)