Skip to content

Commit

Permalink
fix(asan): fixing issues found by address sanitizer
Browse files Browse the repository at this point in the history
Signed-off-by: Dmitry Savitskiy <[email protected]>
  • Loading branch information
dsavitskiy committed Oct 25, 2023
1 parent 4b14067 commit 9b36fef
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
3 changes: 2 additions & 1 deletion io-engine/src/bdev/nexus/nexus_bdev.rs
Original file line number Diff line number Diff line change
Expand Up @@ -851,10 +851,11 @@ impl<'n> Nexus<'n> {
let name = self.name.clone();

// After calling unregister_bdev_async(), Nexus is gone.
let evt = self.event(EventAction::Delete);
match self.as_mut().bdev_mut().unregister_bdev_async().await {
Ok(_) => {
info!("Nexus '{name}': nexus destroyed ok");
self.event(EventAction::Delete).generate();
evt.generate();
Ok(())
}
Err(err) => {
Expand Down
7 changes: 4 additions & 3 deletions io-engine/src/core/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,7 @@ impl ToErrno for CoreError {

/// Logical volume layer failure.
#[derive(Debug, Copy, Clone, Eq, PartialOrd, PartialEq)]
#[repr(C)]
pub enum LvolFailure {
NoSpace,
}
Expand All @@ -472,6 +473,7 @@ pub enum IoSubmissionFailure {
// Generic I/O completion status for block devices, which supports per-protocol
// error domains.
#[derive(Copy, Clone, Eq, PartialOrd, PartialEq)]
#[repr(C)]
pub enum IoCompletionStatus {
Success,
NvmeError(NvmeStatus),
Expand Down Expand Up @@ -501,10 +503,9 @@ impl From<NvmeStatus> for IoCompletionStatus {
match s {
NvmeStatus::NO_SPACE
| NvmeStatus::Generic(SPDK_NVME_SC_CAPACITY_EXCEEDED) => {
IoCompletionStatus::LvolError(LvolFailure::NoSpace)
Self::LvolError(LvolFailure::NoSpace)
}

_ => IoCompletionStatus::NvmeError(s),
_ => Self::NvmeError(s),
}
}
}
Expand Down
4 changes: 3 additions & 1 deletion io-engine/src/lvs/lvs_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -683,6 +683,8 @@ impl Lvs {

let base_bdev = self.base_bdev();

let evt = self.event(EventAction::Delete);

unsafe {
vbdev_lvs_destruct(
self.as_inner_ptr(),
Expand All @@ -700,7 +702,7 @@ impl Lvs {

info!("{}: lvs destroyed successfully", self_str);

self.event(EventAction::Delete).generate();
evt.generate();

bdev_destroy(&base_bdev.bdev_uri_original_str().unwrap())
.await
Expand Down
2 changes: 1 addition & 1 deletion spdk-rs
Submodule spdk-rs updated 1 files
+1 −0 src/nvme.rs

0 comments on commit 9b36fef

Please sign in to comment.