From nobody Wed May 7 21:37:06 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Zt7rg3qvCz5vKNH; Wed, 07 May 2025 21:37:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Zt7rg0Mhvz3lxj; Wed, 07 May 2025 21:37:07 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1746653827; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Xa/UpkkiTNZH1Tp2g2v39mcHm75zpsANT7rknKHcySo=; b=SlxvpFVDP+8e7D8UdT5cguyodXoi1Kv6X/QnWCW/h1twi8vL0lp+VHJHQy2tjGxtapTmkS 6NG69lJxdxsInlSjL9WANAc8pp8Zx+qhqpu6veMRHXFinOAP/vRb8eH5PMX+Axpw30Ged8 UnDyotH/m7HuKOhas0+Wi+dyvlUbobhAUQ82CRjid/TPqh7FItgjrENBut2T8shiVl674t CvSsqIDGCKsTUMtbffEB2S8uNT6hAtsJtYNVF2zn7HDDuEPyK4tYvrVwpcfWix6Q94AGYD N35r859MkIeBnhnQ5DweB517///rV58nUwBGOaWmOVMeuZhGX7ffRiEcCxk2VQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1746653827; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Xa/UpkkiTNZH1Tp2g2v39mcHm75zpsANT7rknKHcySo=; b=T2Gw875aCUCA/txlYrNeFGH2jE06sTHKvbnzjGwOFAgB/GpWyTGoy1akf5n/tklZO0kVAM qxEBM7DopeLnUQ8hD2M3FiX6Jg2hNe8EtKPijwwz6bRE2g//JZKQ/1BwPxFDiYei5pUsBa FnzB7TjUzQsyDVEWobuyY9+K9Or0sbm6DZt36PyFpyPeeLahlULX6f6NCJly83qoS8MTfU s9ELHnn5u2TZ68R9IQiKmB5txfugksS84lUlSnypJzSZiTwsuB6S6Oh8UP7r/fuguBgghE PbcqZuyw9YNmJSmtdkExmS5oDfnHbCdZiqUn2I2jJ3Knl3UweDXrLDNrJnRTzQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1746653827; a=rsa-sha256; cv=none; b=c4vl1OHP2Ne87lcv5GkoC5ccv80qGce6tkT00RpFnOfjEl+6fHkff4zxvoT4nmBMDhNTYx y52pJ70c1Ud9BdPtVAawKNKe85L/H6e9EjA6ou2K1gXSHn/90FLu3Ua8WIpwhnaqi31xEb /ggtKgAsjlasreLQxGa9GcQlwHyE4azV+tGbDrSN9r71rtB+lDCWsPFfjX2Ez/NkNzDwbj pqRv67OhJhGudj12a9mstfVusPnANx5wAHbVi4lUJa0Cg/JL1IwzMkgry/AdEKwMCZWb80 aE6WEtDOlZ49BbagDlcZrQNfN3RKOJB8mQWowWNUD3ZgtvQizobUX+cGPi8dDQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Zt7rf6xGNzmpl; Wed, 07 May 2025 21:37:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 547Lb6jb091991; Wed, 7 May 2025 21:37:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 547Lb61c091989; Wed, 7 May 2025 21:37:06 GMT (envelope-from git) Date: Wed, 7 May 2025 21:37:06 GMT Message-Id: <202505072137.547Lb61c091989@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: db860eb348ad - main - umass: Document the ideal that it's better to fail bad commands List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: db860eb348ad20e4c4be09c9b65cdf0a3b1b57c2 Auto-Submitted: auto-generated The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=db860eb348ad20e4c4be09c9b65cdf0a3b1b57c2 commit db860eb348ad20e4c4be09c9b65cdf0a3b1b57c2 Author: Warner Losh AuthorDate: 2025-05-07 16:07:11 +0000 Commit: Warner Losh CommitDate: 2025-05-07 21:36:54 +0000 umass: Document the ideal that it's better to fail bad commands Generally, lying to the periph drivers about commands working is a bad idea. They cannot get a global insight into the actual capacities of the device when commands just work. There's good reason to intercept bad commands at times, and to prevent the device from being exposed to commands that, for example, hand the device. However, upper layer periph drivers is the better place to cope with devices that don't support the commands since it can make other inferences about the device when it has wider knowledge. But this represents a change in philosphy, so document that as well. This shift happened for some commands a while ago. Many of the quirks existed only to avoid whining errors on boot that were benign and were a big burden. So da and cd slowly stopped the whining. Except in cases where the command hangs the drive, we should limit new quirks and avoid overly broad quirks (things work, but are less performant or reliable, again mostly to avoid harmless errors that are no longer printed). Other sims will likely need some help with this. Differential Revision: https://reviews.freebsd.org/D49467 Sponsored by: Netflix --- sys/dev/usb/storage/umass.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sys/dev/usb/storage/umass.c b/sys/dev/usb/storage/umass.c index 0a62e97a07fe..8922b3770e6a 100644 --- a/sys/dev/usb/storage/umass.c +++ b/sys/dev/usb/storage/umass.c @@ -2230,6 +2230,13 @@ umass_cam_action(struct cam_sim *sim, union ccb *ccb) * command format needed by the specific command set * and return the converted command in * "sc->sc_transfer.cmd_data" + * + * For commands we know the device doesn't support, we + * either complete them with an illegal request, or fake + * the completion, based on what upper layers tolerate. + * Ideally, we'd let the periph drivers know and not + * fake things up, but some periphs fall short of the + * ideal. */ if (umass_std_transform(sc, ccb, cmd, ccb->csio.cdb_len)) { if (sc->sc_transfer.cmd_data[0] == INQUIRY) {