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
This commit is contained in:
Warner Losh 2022-04-28 16:29:39 -06:00
parent ca420b4ef2
commit 9fb40baf60

View File

@ -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;