git: 966c6be6c8be - main - umass: fail synchronize_cache

From: Warner Losh <imp_at_FreeBSD.org>
Date: Wed, 07 May 2025 21:37:05 UTC
The branch main has been updated by imp:

URL: https://cgit.FreeBSD.org/src/commit/?id=966c6be6c8be74d67303f99b5f2d0329de5b64e7

commit 966c6be6c8be74d67303f99b5f2d0329de5b64e7
Author:     Warner Losh <imp@FreeBSD.org>
AuthorDate: 2025-05-07 16:07:05 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2025-05-07 21:36:54 +0000

    umass: fail synchronize_cache
    
    When we know the umass device doesn't support synchronize cache
    (either probed or hard quirk), fail the command w/o sending it to the
    device. The da driver is the only driver that sends this command, and
    since this filter was written has grown the ability to catch the
    failure and never send the command again.
    
    In an ideal world, we'd let the da driver work this out. However,
    there's a lot of devices that hang when this command is sent in a way
    that's impossible to detect other than a black list. There's also a
    number that require a hard USB endpoint reset to recover, which the
    autoquirk code takes care of. So umass has to act as a filter.
    
    By failing this command, we're able to avoid upper level BIO_FLUSH
    commands by tagging the underlying disk as not supporting that.
    
    Differential Revision:  https://reviews.freebsd.org/D49466
    Sponsored by:           Netflix
---
 sys/dev/usb/storage/umass.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/sys/dev/usb/storage/umass.c b/sys/dev/usb/storage/umass.c
index 145c2ba81b3c..0a62e97a07fe 100644
--- a/sys/dev/usb/storage/umass.c
+++ b/sys/dev/usb/storage/umass.c
@@ -2290,9 +2290,7 @@ umass_cam_action(struct cam_sim *sim, union ccb *ccb)
 					}
 				} else if (sc->sc_transfer.cmd_data[0] == SYNCHRONIZE_CACHE) {
 					if (sc->sc_quirks & NO_SYNCHRONIZE_CACHE) {
-						ccb->csio.scsi_status = SCSI_STATUS_OK;
-						ccb->ccb_h.status = CAM_REQ_CMP;
-						xpt_done(ccb);
+						umass_cam_illegal_request(ccb);
 						goto done;
 					}
 				} else if (sc->sc_transfer.cmd_data[0] == START_STOP_UNIT) {