Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 12 Jul 2016 02:57:13 +0000 (UTC)
From:      Sepherosa Ziehau <sephe@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r302605 - head/sys/dev/hyperv/storvsc
Message-ID:  <201607120257.u6C2vD9i005672@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: sephe
Date: Tue Jul 12 02:57:13 2016
New Revision: 302605
URL: https://svnweb.freebsd.org/changeset/base/302605

Log:
  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

Modified:
  head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c

Modified: head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c
==============================================================================
--- head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c	Tue Jul 12 02:16:48 2016	(r302604)
+++ head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c	Tue Jul 12 02:57:13 2016	(r302605)
@@ -805,6 +805,13 @@ hv_storvsc_on_iocompletion(struct storvs
 
 	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 */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201607120257.u6C2vD9i005672>