Date: Thu, 27 Feb 2020 14:50:02 +0000 (UTC) From: Andriy Gapon <avg@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r358384 - stable/12/sys/dev/hyperv/storvsc Message-ID: <202002271450.01REo2pd061077@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: avg Date: Thu Feb 27 14:50:02 2020 New Revision: 358384 URL: https://svnweb.freebsd.org/changeset/base/358384 Log: MFC r356730: storvsc: properly set residual data length on errors This change is based on Linux commit 40630f462824ee. csio.resid should account for transfer_len only for success and SRB_STATUS_DATA_OVERRUN condition. I am not sure how exactly this change works, but I have a report from a user that they see lots of checksum errors when running a pool scrub concurrently with iozone -l 1 -s 100G. After applying this patch the problem cannot be reproduced. Sponsored by: CyberSecure Modified: stable/12/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c stable/12/sys/dev/hyperv/storvsc/hv_vstorage.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c ============================================================================== --- stable/12/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Thu Feb 27 14:48:12 2020 (r358383) +++ stable/12/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Thu Feb 27 14:50:02 2020 (r358384) @@ -2278,7 +2278,11 @@ storvsc_io_done(struct hv_storvsc_request *reqp) } ccb->csio.scsi_status = (vm_srb->scsi_status & 0xFF); - ccb->csio.resid = ccb->csio.dxfer_len - vm_srb->transfer_len; + if (srb_status == SRB_STATUS_SUCCESS || + srb_status == SRB_STATUS_DATA_OVERRUN) + ccb->csio.resid = ccb->csio.dxfer_len - vm_srb->transfer_len; + else + ccb->csio.resid = ccb->csio.dxfer_len; if (reqp->sense_info_len != 0) { csio->sense_resid = csio->sense_len - reqp->sense_info_len; Modified: stable/12/sys/dev/hyperv/storvsc/hv_vstorage.h ============================================================================== --- stable/12/sys/dev/hyperv/storvsc/hv_vstorage.h Thu Feb 27 14:48:12 2020 (r358383) +++ stable/12/sys/dev/hyperv/storvsc/hv_vstorage.h Thu Feb 27 14:50:02 2020 (r358384) @@ -245,7 +245,8 @@ struct vstor_packet { #define SRB_STATUS_SUCCESS 0x01 #define SRB_STATUS_ABORTED 0x02 #define SRB_STATUS_ERROR 0x04 -#define SRB_STATUS_INVALID_LUN 0x20 +#define SRB_STATUS_DATA_OVERRUN 0x12 +#define SRB_STATUS_INVALID_LUN 0x20 /** * SRB Status Masks (can be combined with above status codes) */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202002271450.01REo2pd061077>