Skip to content

Commit

Permalink
feat(nvme): On command completion handle zoned nvme errors
Browse files Browse the repository at this point in the history
Zoned related CommandSpecificStatusCodes's should not take out the
nexus.

Signed-off-by: Dennis Maisenbacher <[email protected]>
  • Loading branch information
MaisenbacherD committed Jun 7, 2024
1 parent 0e10011 commit 344c3fb
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 3 deletions.
8 changes: 6 additions & 2 deletions io-engine/src/bdev/nexus/nexus_io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ use crate::core::{
CoreError,
Cores,
IoCompletionStatus,
is_zoned_nvme_error,
IoStatus,
IoSubmissionFailure,
IoType,
Expand Down Expand Up @@ -271,9 +272,12 @@ impl<'n> NexusBio<'n> {
self.ctx_mut().successful += 1;
} else {
self.ctx_mut().status = IoStatus::Failed;
self.ctx_mut().failed += 1;

self.completion_error(child, status);
// Don't take zoned child out on zoned related nvme errors
if !is_zoned_nvme_error(status) {
self.ctx_mut().failed += 1;
self.completion_error(child, status);
}
}

if self.ctx().in_flight > 0 {
Expand Down
30 changes: 29 additions & 1 deletion io-engine/src/core/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,17 @@ pub use snapshot::{
SnapshotXattrs,
};

use spdk_rs::libspdk::SPDK_NVME_SC_CAPACITY_EXCEEDED;
use spdk_rs::libspdk::{
SPDK_NVME_SC_CAPACITY_EXCEEDED,
SPDK_NVME_SC_ZONED_BOUNDARY_ERROR,
SPDK_NVME_SC_ZONE_IS_FULL,
SPDK_NVME_SC_ZONE_IS_READ_ONLY,
SPDK_NVME_SC_ZONE_IS_OFFLINE,
SPDK_NVME_SC_ZONE_INVALID_WRITE,
SPDK_NVME_SC_TOO_MANY_ACTIVE_ZONES,
SPDK_NVME_SC_TOO_MANY_OPEN_ZONES,
SPDK_NVME_SC_INVALID_ZONE_STATE_TRANSITION,
};

mod bdev;
mod block_device;
Expand Down Expand Up @@ -528,6 +538,24 @@ impl From<NvmeStatus> for IoCompletionStatus {
}
}

/// Returns true if the given IoCompletionStatus NvmeError can be matched to a Zoned Namespace Command Specific Status Code
pub fn is_zoned_nvme_error(status: IoCompletionStatus) -> bool {
match status {
IoCompletionStatus::NvmeError(NvmeStatus::CmdSpecific(cssc)) => match cssc {
SPDK_NVME_SC_ZONED_BOUNDARY_ERROR |
SPDK_NVME_SC_ZONE_IS_FULL |
SPDK_NVME_SC_ZONE_IS_READ_ONLY |
SPDK_NVME_SC_ZONE_IS_OFFLINE |
SPDK_NVME_SC_ZONE_INVALID_WRITE |
SPDK_NVME_SC_TOO_MANY_ACTIVE_ZONES |
SPDK_NVME_SC_TOO_MANY_OPEN_ZONES |
SPDK_NVME_SC_INVALID_ZONE_STATE_TRANSITION => true,
_ => false,
},
_ => false,
}
}

// TODO move this elsewhere ASAP
pub static PAUSING: AtomicUsize = AtomicUsize::new(0);
pub static PAUSED: AtomicUsize = AtomicUsize::new(0);
Expand Down

0 comments on commit 344c3fb

Please sign in to comment.