Re: [PATCH] libata-eh copy result_tf flags from outgoing tf

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Tejun Heo wrote:
Mark Lord wrote:
Fix mis-reporting of NCQ errors by copying tf->flags to result_tf->flags
in libata-eh.  This allows ata_gen_ata_sense() to report the failed
block number correctly to SCSI after a media error during NCQ.

This patch may also be a candidate for backporting to earlier kernels.
Without this fix, SCSI will fail I/O on the entire request rather
than just the bad sector.  That can be bad for a request that was
merged from many independent read reads from different tasks.

Signed-off-by: Mark Lord <mlord@xxxxxxxxx>

--- upstream/drivers/ata/libata-eh.c 2008-04-18 09:31:15.000000000 -0400
+++ linux/drivers/ata/libata-eh.c    2008-04-23 16:25:38.000000000 -0400
@@ -1402,6 +1402,7 @@
    /* we've got the perpetrator, condemn it */
    qc = __ata_qc_from_tag(ap, tag);
    memcpy(&qc->result_tf, &tf, sizeof(tf));
+    qc->result_tf.flags = qc->tf.flags;

Maybe it's better to set ATA_TFLAG_LBA48 | ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE? After all, all fields are available after that memcpy().
..

I just did it the same way as the standard version in libata-core does it.
In this particular case, we know it was NCQ, so we know that the original
tf->flags have (ATA_TFLAG_LBA48|ATA_TFLAG_ISADDR|ATA_TFLAG_DEVICE) set.

I figured better to copy than just overwrite, because new flags might come along.

Cheers
--
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Filesystems]     [Linux SCSI]     [Linux RAID]     [Git]     [Kernel Newbies]     [Linux Newbie]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Samba]     [Device Mapper]

  Powered by Linux