Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 21 May 2021 10:32:36 GMT
From:      Andriy Gapon <avg@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 4a7dcb174ce8 - stable/13 - storvsc: fix auto-sense reporting
Message-ID:  <202105211032.14LAWaBP064041@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by avg:

URL: https://cgit.FreeBSD.org/src/commit/?id=4a7dcb174ce87c1e771486eb956ef697914fcc44

commit 4a7dcb174ce87c1e771486eb956ef697914fcc44
Author:     Andriy Gapon <avg@FreeBSD.org>
AuthorDate: 2021-05-07 07:17:57 +0000
Commit:     Andriy Gapon <avg@FreeBSD.org>
CommitDate: 2021-05-21 10:32:13 +0000

    storvsc: fix auto-sense reporting
    
    I saw a situation where the driver set CAM_AUTOSNS_VALID on a failed ccb
    even though SRB_STATUS_AUTOSENSE_VALID was not set in the status.
    The actual sense data remained all zeros.
    The problem seems to be that create_storvsc_request() always sets
    hv_storvsc_request::sense_info_len, so checking for sense_info_len != 0
    is not enough to determine if any auto-sense data is actually available.
    
    Sponsored by:   CyberSecure
    
    (cherry picked from commit 8afecefd57c5ac95200f43227cd00f265154acee)
---
 sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c b/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c
index 968de9d14e7b..702308e26a1d 100644
--- a/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c
+++ b/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c
@@ -2406,7 +2406,8 @@ storvsc_io_done(struct hv_storvsc_request *reqp)
 	else
 		ccb->csio.resid = ccb->csio.dxfer_len;
 
-	if (reqp->sense_info_len != 0) {
+	if ((vm_srb->srb_status & SRB_STATUS_AUTOSENSE_VALID) != 0 &&
+	    reqp->sense_info_len != 0) {
 		csio->sense_resid = csio->sense_len - reqp->sense_info_len;
 		ccb->ccb_h.status |= CAM_AUTOSNS_VALID;
 	}



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