Commit fcf1bf15 authored by Tejun Heo's avatar Tejun Heo Committed by Jeff Garzik

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: default avatarTejun Heo <htejun@gmail.com>
Signed-off-by: default avatarJeff Garzik <jeff@garzik.org>
parent 6d1245bf
......@@ -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 {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment