git: a945c21a6101 - main - umass: Fail SYNCHRONIZE_CACHE for UFI

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

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

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

    umass: Fail SYNCHRONIZE_CACHE for UFI
    
    Just go ahead and fail SYNCHRONIZE_CACHE commands for UFI. This standard
    doesn't have a cache to flush, and the upper layers (aka da) will notice sync
    cache failed and won't send it again.
    
    Sponsored by:           Netflix
    Differential Revision:  https://reviews.freebsd.org/D49468
---
 sys/dev/usb/storage/umass.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/sys/dev/usb/storage/umass.c b/sys/dev/usb/storage/umass.c
index 8922b3770e6a..bdbe04ce3bbd 100644
--- a/sys/dev/usb/storage/umass.c
+++ b/sys/dev/usb/storage/umass.c
@@ -2825,12 +2825,11 @@ umass_ufi_transform(struct umass_softc *sc, uint8_t *cmd_ptr,
 
 		/*
 		 * SYNCHRONIZE_CACHE isn't supported by UFI, nor should it be
-		 * required for UFI devices, so it is appropriate to fake
-		 * success.
+		 * required for UFI devices. Just fail it, the upper layers
+		 * know what to do.
 		 */
 	case SYNCHRONIZE_CACHE:
-		return (2);
-
+		return (0);
 	default:
 		DPRINTF(sc, UDMASS_SCSI, "Unsupported UFI "
 		    "command 0x%02x\n", cmd_ptr[0]);