]> git.openfabrics.org - ~shefty/rdma-dev.git/commitdiff
libata: fix ata_scmd_need_defer()
authorTejun Heo <htejun@gmail.com>
Tue, 20 Feb 2007 14:27:06 +0000 (23:27 +0900)
committerJeff Garzik <jeff@garzik.org>
Wed, 21 Feb 2007 09:58:18 +0000 (04:58 -0500)
Fix ata_scmd_need_defer() such that...

* whether NCQ is used or not is exactly determined using the same
  criteria as the issue path.

* defer-check is performed in all cases.

This fixes race condition where turning off NCQ on the fly causes
non-NCQ commands sneak into NCQ phase.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
drivers/ata/libata-scsi.c

index 7bb782b5ce0c5ae8bc86380cb654055023e8349c..aa6cb6dcec4169a3df98f9f0baa2e8e6ccdc8528 100644 (file)
@@ -1496,11 +1496,9 @@ static void ata_scsi_qc_complete(struct ata_queued_cmd *qc)
 static int ata_scmd_need_defer(struct ata_device *dev, int is_io)
 {
        struct ata_port *ap = dev->ap;
+       int is_ncq = is_io && ata_ncq_enabled(dev);
 
-       if (!(dev->flags & ATA_DFLAG_NCQ))
-               return 0;
-
-       if (is_io) {
+       if (is_ncq) {
                if (!ata_tag_valid(ap->active_tag))
                        return 0;
        } else {