Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 39599a53 authored by Tejun Heo's avatar Tejun Heo Committed by Jeff Garzik
Browse files

[PATCH] libata: sync result_tf.flags w/ command tf.flags



libata didn't initialize result_tf.flags which indicates transfer type
(RW/FUA) and address type (CHS/LBA/LBA48).  ata_gen_fixed_sense()
assumed result_tf.flags equals command tf.flags and failed to report
the first failed block to SCSI layer because zero tf flags indicates
CHS and bad block reporting for CHS is not implemented.

Implement fill_result_tf() which sets result_tf.flags to command
tf.flags and use it to fill result_tf.

Signed-off-by: default avatarTejun Heo <htejun@gmail.com>
Signed-off-by: default avatarJeff Garzik <jeff@garzik.org>
parent 61c0596c
Loading
Loading
Loading
Loading
+11 −3
Original line number Original line Diff line number Diff line
@@ -4536,6 +4536,14 @@ void __ata_qc_complete(struct ata_queued_cmd *qc)
	qc->complete_fn(qc);
	qc->complete_fn(qc);
}
}


static void fill_result_tf(struct ata_queued_cmd *qc)
{
	struct ata_port *ap = qc->ap;

	ap->ops->tf_read(ap, &qc->result_tf);
	qc->result_tf.flags = qc->tf.flags;
}

/**
/**
 *	ata_qc_complete - Complete an active ATA command
 *	ata_qc_complete - Complete an active ATA command
 *	@qc: Command to complete
 *	@qc: Command to complete
@@ -4573,7 +4581,7 @@ void ata_qc_complete(struct ata_queued_cmd *qc)
		if (unlikely(qc->flags & ATA_QCFLAG_FAILED)) {
		if (unlikely(qc->flags & ATA_QCFLAG_FAILED)) {
			if (!ata_tag_internal(qc->tag)) {
			if (!ata_tag_internal(qc->tag)) {
				/* always fill result TF for failed qc */
				/* always fill result TF for failed qc */
				ap->ops->tf_read(ap, &qc->result_tf);
				fill_result_tf(qc);
				ata_qc_schedule_eh(qc);
				ata_qc_schedule_eh(qc);
				return;
				return;
			}
			}
@@ -4581,7 +4589,7 @@ void ata_qc_complete(struct ata_queued_cmd *qc)


		/* read result TF if requested */
		/* read result TF if requested */
		if (qc->flags & ATA_QCFLAG_RESULT_TF)
		if (qc->flags & ATA_QCFLAG_RESULT_TF)
			ap->ops->tf_read(ap, &qc->result_tf);
			fill_result_tf(qc);


		__ata_qc_complete(qc);
		__ata_qc_complete(qc);
	} else {
	} else {
@@ -4590,7 +4598,7 @@ void ata_qc_complete(struct ata_queued_cmd *qc)


		/* read result TF if failed or requested */
		/* read result TF if failed or requested */
		if (qc->err_mask || qc->flags & ATA_QCFLAG_RESULT_TF)
		if (qc->err_mask || qc->flags & ATA_QCFLAG_RESULT_TF)
			ap->ops->tf_read(ap, &qc->result_tf);
			fill_result_tf(qc);


		__ata_qc_complete(qc);
		__ata_qc_complete(qc);
	}
	}