diff options
author | Andriy Gapon <avg@FreeBSD.org> | 2021-05-07 07:17:57 +0000 |
---|---|---|
committer | Andriy Gapon <avg@FreeBSD.org> | 2021-05-21 13:49:54 +0000 |
commit | 9120716d91d4d98fc7fe4833bda13e100cdd3b31 (patch) | |
tree | 61876bbf21999ba1af5e9e301e24d21e1411ccfc | |
parent | 4b9d54e2aeca7435698bd37a2d99416acb23c9b5 (diff) | |
download | src-9120716d91d4d98fc7fe4833bda13e100cdd3b31.tar.gz src-9120716d91d4d98fc7fe4833bda13e100cdd3b31.zip |
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)
-rw-r--r-- | sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c | 3 |
1 files changed, 2 insertions, 1 deletions
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; } |