Skip to content

Commit

Permalink
Clean up and bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
jbaublitz committed Apr 1, 2022
1 parent 7724f5a commit d2e9830
Show file tree
Hide file tree
Showing 4 changed files with 167 additions and 160 deletions.
16 changes: 4 additions & 12 deletions src/engine/strat_engine/backstore/backstore.rs
Original file line number Diff line number Diff line change
Expand Up @@ -511,25 +511,17 @@ impl Backstore {
self.data_tier.destroy()
}

/// Run code required to stop a pool on backstore data structures.
pub fn stop(&mut self) -> StratisResult<()> {
self.data_tier.block_mgr.teardown()
}

/// Teardown the DM devices in the backstore.
#[cfg(test)]
pub fn teardown(&mut self) -> StratisResult<()> {
match self.cache {
Some(ref mut cache) => cache.teardown(get_dm()),
Some(ref mut cache) => cache.teardown(get_dm())?,
None => {
if let Some(ref mut linear) = self.linear {
linear.teardown(get_dm())
} else {
Ok(())
linear.teardown(get_dm())?;
}
}
}
.map_err(|e| e.into())
};
self.data_tier.block_mgr.teardown()
}

/// Return the device that this tier is currently using.
Expand Down
4 changes: 4 additions & 0 deletions src/engine/strat_engine/backstore/blockdev.rs
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,10 @@ impl StratBlockDev {
/// physical device.
pub fn teardown(&mut self) -> StratisResult<()> {
if let Some(ch) = self.underlying_device.crypt_handle() {
debug!(
"Deactivating unlocked encrypted device with UUID {}",
self.bda.dev_uuid()
);
ch.deactivate()
} else {
Ok(())
Expand Down
Loading

0 comments on commit d2e9830

Please sign in to comment.