From: Tejun Heo Date: Tue, 20 Feb 2007 14:27:06 +0000 (+0900) Subject: libata: fix ata_scmd_need_defer() X-Git-Tag: v2.6.21-rc2~25^2~36 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=fcf1bf1584647f9fd864c193fee81840c4c5ce41;p=linux-2.6-omap-h63xx.git libata: fix ata_scmd_need_defer() 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 Signed-off-by: Jeff Garzik --- diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c index 7bb782b5ce0..aa6cb6dcec4 100644 --- a/drivers/ata/libata-scsi.c +++ b/drivers/ata/libata-scsi.c @@ -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 {