Skip to content

Commit

Permalink
libata: fix ata_scmd_need_defer()
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Jeff Garzik <[email protected]>
  • Loading branch information
htejun authored and Jeff Garzik committed Feb 21, 2007
1 parent 6d1245b commit fcf1bf1
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions drivers/ata/libata-scsi.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit fcf1bf1

Please sign in to comment.