Date: Sat, 8 Feb 2025 21:43:10 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: 82fc49a0bebf - main - cam/da: Only mark pack as valid if we know the size in daopen Message-ID: <202502082143.518LhASY097539@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=82fc49a0bebf3f05e0584a1ed5cc6bbfd1cbd475 commit 82fc49a0bebf3f05e0584a1ed5cc6bbfd1cbd475 Author: Warner Losh <imp@FreeBSD.org> AuthorDate: 2025-02-08 21:31:07 +0000 Commit: Warner Losh <imp@FreeBSD.org> CommitDate: 2025-02-08 21:31:07 +0000 cam/da: Only mark pack as valid if we know the size in daopen Only mark the pack as 'valid' (eg clear the invalid bit) when we know the size of the underlying drive and the periph hasn't been invalidated. Previously, we'd unconditionally clear this bit, but if the size isn't known, no I/O to the drive is possible. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D48688 --- sys/cam/scsi/scsi_da.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/sys/cam/scsi/scsi_da.c b/sys/cam/scsi/scsi_da.c index 1e685dc2a9e3..44dc21d1bc2f 100644 --- a/sys/cam/scsi/scsi_da.c +++ b/sys/cam/scsi/scsi_da.c @@ -1803,10 +1803,17 @@ daopen(struct disk *dp) (softc->quirks & DA_Q_NO_PREVENT) == 0) daprevent(periph, PR_PREVENT); - if (error == 0) { + /* + * Only 'validate' the pack if the media size is non-zero and the + * underlying peripheral isn't invalid (the only error != 0 path). + */ + if (error == 0 && softc->params.sectors != 0) softc->flags &= ~DA_FLAG_PACK_INVALID; + else + softc->flags |= DA_FLAG_PACK_INVALID; + + if (error == 0) softc->flags |= DA_FLAG_OPEN; - } da_periph_unhold(periph, DA_REF_OPEN_HOLD); cam_periph_unlock(periph);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202502082143.518LhASY097539>