hyperv/stor: Save the response status and xfer length properly.

The current command response handling discards status and xfer
length unconditionally, so that all of the commands would be
considered successful, even if errors happened.  When errors
really happens, this causes all kinds of wiredness, since the
buffer will not be filled on the host side and sense data will
be ignored.

Most of the time, errors do not happen, however, error does
happen for the request sent immediately after the disk resizing.
Discarding the SCSI status (SCSI_STATUS_CHECK_COND) and sense
data (capacity changes) prevents the disk resizing from working
properly.

This commit saves the response status and xfer length properly
for later use.

Submitted by:	Dexuan Cui <decui microsoft com>
Noticed by:	sephe
MFC after:	3 days
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D7181
This commit is contained in:
sephe 2016-07-12 02:57:13 +00:00
parent 793882767c
commit 2d2d509005

View File

@ -805,6 +805,13 @@ hv_storvsc_on_iocompletion(struct storvsc_softc *sc,
vm_srb = &vstor_packet->u.vm_srb;
/*
* Copy some fields of the host's response into the request structure,
* because the fields will be used later in storvsc_io_done().
*/
request->vstor_packet.u.vm_srb.scsi_status = vm_srb->scsi_status;
request->vstor_packet.u.vm_srb.transfer_len = vm_srb->transfer_len;
if (((vm_srb->scsi_status & 0xFF) == SCSI_STATUS_CHECK_COND) &&
(vm_srb->srb_status & SRB_STATUS_AUTOSENSE_VALID)) {
/* Autosense data available */