svn commit: r356730 - head/sys/dev/hyperv/storvsc
Andriy Gapon
avg at FreeBSD.org
Tue Jan 14 13:20:17 UTC 2020
Author: avg
Date: Tue Jan 14 13:20:16 2020
New Revision: 356730
URL: https://svnweb.freebsd.org/changeset/base/356730
Log:
storvsc: port a Linux patch, 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.
Reviewed by: nobody
Sponsored by: CyberSecure
Differential Revision: https://reviews.freebsd.org/D22312
Modified:
head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c
head/sys/dev/hyperv/storvsc/hv_vstorage.h
Modified: head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c
==============================================================================
--- head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Tue Jan 14 11:33:07 2020 (r356729)
+++ head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Tue Jan 14 13:20:16 2020 (r356730)
@@ -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: head/sys/dev/hyperv/storvsc/hv_vstorage.h
==============================================================================
--- head/sys/dev/hyperv/storvsc/hv_vstorage.h Tue Jan 14 11:33:07 2020 (r356729)
+++ head/sys/dev/hyperv/storvsc/hv_vstorage.h Tue Jan 14 13:20:16 2020 (r356730)
@@ -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)
*/
More information about the svn-src-head
mailing list