Date: Thu, 6 Feb 2025 18:42:36 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: d8c9f53922c6 - main - cam/da: Add some comments about 28/0 asc Message-ID: <202502061842.516IgaIp057896@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=d8c9f53922c6ae083a0f49594c29b2df03d61c35 commit d8c9f53922c6ae083a0f49594c29b2df03d61c35 Author: Warner Losh <imp@FreeBSD.org> AuthorDate: 2025-02-06 18:18:59 +0000 Commit: Warner Losh <imp@FreeBSD.org> CommitDate: 2025-02-06 18:40:22 +0000 cam/da: Add some comments about 28/0 asc We don't set the PACK_INVALID flag in response to asc 28/0 "NOT READY TO READY CHANGE, MEDIUM MAY HAVE CHANGED". Explain why: we usally retry this (since it's a UNIT ATTENTION) and it works and/or it's before daopen. In addition, improve the comment about the asysnc unit attention to make it a little more understandable. This is likely sufficient (it's been since before FreeBSD 3.0 when this hack was put in). Ideally, we'd verify what medium is there, but knowing when it's the same is a bit tricky... Differential Revision: https://reviews.freebsd.org/D48839 Sponsored by: Netflix --- sys/cam/scsi/scsi_da.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/sys/cam/scsi/scsi_da.c b/sys/cam/scsi/scsi_da.c index f2f3951ebe80..c2805a71850c 100644 --- a/sys/cam/scsi/scsi_da.c +++ b/sys/cam/scsi/scsi_da.c @@ -2198,7 +2198,8 @@ daasync(void *callback_arg, uint32_t code, ccb = (union ccb *)arg; /* - * Handle all UNIT ATTENTIONs except our own, as they will be + * Unit attentions are broadcast to all the LUNs of the device + * so handle all UNIT ATTENTIONs except our own, as they will be * handled by daerror(). */ if (xpt_path_periph(ccb->ccb_h.path) != periph && @@ -6028,6 +6029,16 @@ daerror(union ccb *ccb, uint32_t cam_flags, uint32_t sense_flags) /* 28/0: NOT READY TO READY CHANGE, MEDIUM MAY HAVE CHANGED */ softc->flags &= ~DA_FLAG_PROBED; disk_media_changed(softc->disk, M_NOWAIT); + /* + * In an ideal world, we'd make sure that we have the + * same medium mounted (if we'd seen one already) but + * instead we don't invalidate the pack here and flag + * below to retry the UAs. If we exhaust retries, then + * we'll invalidate it in dadone for ENXIO errors (which + * 28/0 will fail with eventually). Usually, retrying + * just works and/or we get this before we've opened the + * device (which clears the invalid flag). + */ } else if (sense_key == SSD_KEY_UNIT_ATTENTION && asc == 0x3F && ascq == 0x03) { /* 3f/3: INQUIRY DATA HAS CHANGED */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202502061842.516IgaIp057896>