Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 4 Feb 2025 18:31:54 GMT
From:      Warner Losh <imp@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: f8ef49c324c9 - main - cam/da: Document what an 'invalid pack' means.
Message-ID:  <202502041831.514IVsbT035228@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by imp:

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

commit f8ef49c324c936aecc9a7d112a45a2e0ad9a47c8
Author:     Warner Losh <imp@FreeBSD.org>
AuthorDate: 2025-02-04 18:29:14 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
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);
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202502041831.514IVsbT035228>