Skip to content

Commit e013e13

Browse files
Jens Axboetorvalds
authored andcommitted
libata: fix bug with non-ncq devices
The recent commit 2fca5cc ("libata: switch to using block layer tagging support") to enable support for block layer tagging in libata was broken for non-NCQ devices The block layer initializes the tag field to -1 to detect invalid uses of a tag, and if the libata devices does NOT support NCQ, we just used that field to index the internal command list. So we need to check for -1 first and only use the tag field if it's valid. Signed-off-by: Jens Axboe <[email protected]> Reported-by: Alexander Beregalov <[email protected]> Tested-by: Paul Mundt <[email protected]> Tested-by: Dave Young <[email protected]> Tested-by: Rafael J. Wysocki <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 57f8f7b commit e013e13

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

drivers/ata/libata-scsi.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -708,7 +708,11 @@ static struct ata_queued_cmd *ata_scsi_qc_new(struct ata_device *dev,
708708
{
709709
struct ata_queued_cmd *qc;
710710

711-
qc = ata_qc_new_init(dev, cmd->request->tag);
711+
if (cmd->request->tag != -1)
712+
qc = ata_qc_new_init(dev, cmd->request->tag);
713+
else
714+
qc = ata_qc_new_init(dev, 0);
715+
712716
if (qc) {
713717
qc->scsicmd = cmd;
714718
qc->scsidone = done;

0 commit comments

Comments
 (0)