git: 9fb40baf6043 - main - cam_periph: Return ENXIO when peripheral is invalidated

From: Warner Losh <imp_at_FreeBSD.org>
Date: Thu, 28 Apr 2022 22:30:14 UTC
The branch main has been updated by imp:

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

commit 9fb40baf60435c000415429220c57c754ce318fd
Author:     Warner Losh <imp@FreeBSD.org>
AuthorDate: 2022-04-28 22:29:39 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2022-04-28 22:30:00 +0000

    cam_periph: Return ENXIO when peripheral is invalidated
    
    When the peripheral is invalidated, no further I/O is possible. Signal
    this up the stack with ENXIO now that upper layers of the stack
    differentiate sometimes. In order for there to be further I/O, and new
    open is required for any block device that a future periph might
    instantiate for devices at this location that might return or otherwise
    become available. The I/O scheduler flushes its I/O with the ENXIO error
    for pending I/O that didn't make it to the device, so this makes the two
    paths match.
    
    MFC After:              3 days
    Sponsored by:           Netflix
    Reviewed by:            chs, mav
    Differential Revision:  https://reviews.freebsd.org/D35093
---
 sys/cam/cam_periph.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/sys/cam/cam_periph.c b/sys/cam/cam_periph.c
index 7f8f0036f10b..8c7c6b53b473 100644
--- a/sys/cam/cam_periph.c
+++ b/sys/cam/cam_periph.c
@@ -1609,7 +1609,7 @@ camperiphscsistatuserror(union ccb *ccb, union ccb **orig_ccb,
 		 */
 		periph = xpt_path_periph(ccb->ccb_h.path);
 		if (periph->flags & CAM_PERIPH_INVALID) {
-			error = EIO;
+			error = ENXIO;
 			*action_string = "Periph was invalidated";
 		} else if ((sense_flags & SF_RETRY_BUSY) != 0 ||
 		    ccb->ccb_h.retry_count > 0) {
@@ -1959,7 +1959,7 @@ cam_periph_error(union ccb *ccb, cam_flags camflags,
 		/* Unconditional requeue if device is still there */
 		if (periph->flags & CAM_PERIPH_INVALID) {
 			action_string = "Periph was invalidated";
-			error = EIO;
+			error = ENXIO;
 		} else if (sense_flags & SF_NO_RETRY) {
 			error = EIO;
 			action_string = "Retry was blocked";
@@ -1987,7 +1987,7 @@ cam_periph_error(union ccb *ccb, cam_flags camflags,
 	case CAM_DATA_RUN_ERR:
 	default:
 		if (periph->flags & CAM_PERIPH_INVALID) {
-			error = EIO;
+			error = ENXIO;
 			action_string = "Periph was invalidated";
 		} else if (ccb->ccb_h.retry_count == 0) {
 			error = EIO;