From nobody Tue Feb 04 18:31:54 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 4YnX5Q6cb8z5mFCc; Tue, 04 Feb 2025 18:31:54 +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 4YnX5Q3mF7z3pFZ; Tue, 04 Feb 2025 18:31:54 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1738693914; 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=gH2acsmNcSsXPjHx3ihGMKl+yH1yYO0OA+gJZ3qvDhg=; b=E8J+S7KxUSnhiZvz6UL3wGPEiGXzqt0G3BUhX08NTZfs1kBgVKeJAKXvvznL6fsEbw25wr 7TbUx6BDA/zQ20Qepjbm9NChh/kl8jd7zQ3RMiLmIKtKq9VM1bOONah7erx4GyV7Im1lyS i/r80sMMy3t8ILo00Fmz0vwFfzkugt3aZN/lQDFmQM4krHdv8FMJSXQIam+1O+NabozuSS V9nRhpyv7woORAKapG/VVzzecJAIJA5UjKfwvZm1QBGwuFQtAFsq4vClXkmkQUraPGvUEq u1zdVf0fqWtIcxs2fIGx76+9ZOJ4yhkfkgsg574qB3D7JJ68I2WgpZ6QnOMNiA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1738693914; 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=gH2acsmNcSsXPjHx3ihGMKl+yH1yYO0OA+gJZ3qvDhg=; b=ugSezo5lO5BYoly4XjerNCR0buCqh6sXtlZ+mSM+IuVuqai8wP7oiSmyIpN8tCEhweXHLP lMVlTnG3c91ZM9req7l1X10auXU8cO7YZfBoDReP6OqjyFsfvOTX9ueg/gu+hkPIbRt913 TiWNVPUApvEgR8EyNIeMI8MR6TMqoja2ElCDsRL1iPWa7Emxtvx03m8v7U2GqmM2fBu7C+ 703XlzZhV7AhURnw1aHu99lpYP7X+wqdYwITuc1Qen7cuM6a0hA/e2QjqicNKgzEZ/UGhq qUyxHqFw3OGEsOSj/2Viu4jkF77L6qXK9ihWeUdfdjmAzQ4Uinpx2YSeMu4VTQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1738693914; a=rsa-sha256; cv=none; b=vLbM3TuqH2EV7YXMGYPHd0S+46iTPznMYZ96Dy69vxAg/ikBCHyfICd7DlJjSNxccf/FSa LPYBEUsFKiAiqGQdfscF+JQBogK5BDoch6fV7c5TvROLRkrEBmP1YwKKdKvcbdLOo09I1P HG+828vOXDUFrd5lr55GjnVfwBLR5kyL5ZP6gWsixofHg9ZJmnKx98dAHs6bs5itSzk14a MO3GMJm/8nWyFX3NFMBblB92p5oqIc3ixD0W+TgejBQql/dQ8bIFOXu8NZ9e9dmKhvt2MN 7rptDO3lAEI3zC4uZN0z0R4OiuQISGnLdLDCeSZ2Owz8AbG+X5Ay9IWenlo1iQ== 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 4YnX5Q2fn1z1ww; Tue, 04 Feb 2025 18:31:54 +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 514IVsBe035231; Tue, 4 Feb 2025 18:31:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 514IVsbT035228; Tue, 4 Feb 2025 18:31:54 GMT (envelope-from git) Date: Tue, 4 Feb 2025 18:31:54 GMT Message-Id: <202502041831.514IVsbT035228@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: f8ef49c324c9 - main - cam/da: Document what an 'invalid pack' means. 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: f8ef49c324c936aecc9a7d112a45a2e0ad9a47c8 Auto-Submitted: auto-generated The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=f8ef49c324c936aecc9a7d112a45a2e0ad9a47c8 commit f8ef49c324c936aecc9a7d112a45a2e0ad9a47c8 Author: Warner Losh AuthorDate: 2025-02-04 18:29:14 +0000 Commit: Warner Losh CommitDate: 2025-02-04 18:29:38 +0000 cam/da: Document what an 'invalid pack' means. An 'invalid pack' in the da driver means that the media for the drive is temproarily missing, pending an action by a third party (eg robot arm or human inserting a disk pack, etc) or has changed since we opened. We invalidate a pack when the ASC/ASCQ tells us the media is missing (ASC 0x3a MEDIA MISSING), for 0x28/0 (NOT READY TO READY CHANGE, MEDIUM MAY HAVE CHANGED) and for that brief period of time after a peripheral has been invalidated before the disk is destroyed. When the pack is invalid, we can't do READ/WRITE operations to the media, so we fail all outstanding I/O and any new I/O that comes in when this happens. This is cleared in daopen when we've repobed the device. Sponsored by: Netflix Reviewed by: mav Differential Revision: https://reviews.freebsd.org/D48687 --- sys/cam/scsi/scsi_da.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/sys/cam/scsi/scsi_da.c b/sys/cam/scsi/scsi_da.c index e8e13613413a..f2f3951ebe80 100644 --- a/sys/cam/scsi/scsi_da.c +++ b/sys/cam/scsi/scsi_da.c @@ -1899,7 +1899,15 @@ dastrategy(struct bio *bp) cam_periph_lock(periph); /* - * If the device has been made invalid, error out + * If the pack has been invalidated, fail all I/O. The medium is not + * suitable for normal I/O, because one or more is ture: + * - the medium is missing + * - its size is unknown + * - it differs from the medium present at daopen + * - we're tearing the cam periph device down + * Since we have the cam periph lock, we don't need to check it for + * the last condition since PACK_INVALID is set when we invalidate + * the device. */ if ((softc->flags & DA_FLAG_PACK_INVALID)) { cam_periph_unlock(periph); @@ -1946,6 +1954,10 @@ dadump(void *arg, void *virtual, off_t offset, size_t length) softc = (struct da_softc *)periph->softc; secsize = softc->params.secsize; + /* + * Can't dump to a disk that's not there or changed, for whatever + * reason. + */ if ((softc->flags & DA_FLAG_PACK_INVALID) != 0) return (ENXIO);