Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 21 May 2021 13:52:40 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: 9120716d91d4 - stable/12 - storvsc: fix auto-sense reporting
Message-ID:  <202105211352.14LDqeEw031063@gitrepo.freebsd.org>

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

URL: https://cgit.FreeBSD.org/src/commit/?id=9120716d91d4d98fc7fe4833bda13e100cdd3b31

commit 9120716d91d4d98fc7fe4833bda13e100cdd3b31
Author:     Andriy Gapon <avg@FreeBSD.org>
AuthorDate: 2021-05-07 07:17:57 +0000
Commit:     Andriy Gapon <avg@FreeBSD.org>
CommitDate: 2021-05-21 13:49:54 +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?202105211352.14LDqeEw031063>