From owner-svn-src-stable-12@freebsd.org Thu Feb 27 14:50:03 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9133C2437BD; Thu, 27 Feb 2020 14:50:03 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 48SwZ32pSGz4BZX; Thu, 27 Feb 2020 14:50:03 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E7C631A567; Thu, 27 Feb 2020 14:50:02 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 01REo2ua061078; Thu, 27 Feb 2020 14:50:02 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 01REo2pd061077; Thu, 27 Feb 2020 14:50:02 GMT (envelope-from avg@FreeBSD.org) Message-Id: <202002271450.01REo2pd061077@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Thu, 27 Feb 2020 14:50:02 +0000 (UTC) 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 X-SVN-Group: stable-12 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: stable/12/sys/dev/hyperv/storvsc X-SVN-Commit-Revision: 358384 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Feb 2020 14:50:03 -0000 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) */