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 <htejun@gmail.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
This commit is contained in:
parent
6d1245bf29
commit
fcf1bf1584
1 changed files with 2 additions and 4 deletions
|
@ -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)
|
static int ata_scmd_need_defer(struct ata_device *dev, int is_io)
|
||||||
{
|
{
|
||||||
struct ata_port *ap = dev->ap;
|
struct ata_port *ap = dev->ap;
|
||||||
|
int is_ncq = is_io && ata_ncq_enabled(dev);
|
||||||
|
|
||||||
if (!(dev->flags & ATA_DFLAG_NCQ))
|
if (is_ncq) {
|
||||||
return 0;
|
|
||||||
|
|
||||||
if (is_io) {
|
|
||||||
if (!ata_tag_valid(ap->active_tag))
|
if (!ata_tag_valid(ap->active_tag))
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
|
|
Reference in a new issue