Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(lvs/lvol): add trace message before zeroing super #1399

Merged
merged 2 commits into from
Jun 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 8 additions & 25 deletions io-engine/src/lvs/lvs_lvol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ use spdk_rs::libspdk::{
vbdev_lvol_destroy,
vbdev_lvol_get_from_bdev,
LVS_CLEAR_WITH_UNMAP,
SPDK_BDEV_LARGE_BUF_MAX_SIZE,
};

use super::{Error, Lvs};
Expand Down Expand Up @@ -294,34 +293,18 @@ impl Lvol {
}
})?;

// Set the buffer size to the maximum allowed by SPDK.
let buf_size = SPDK_BDEV_LARGE_BUF_MAX_SIZE as u64;
let buf = hdl.dma_malloc(buf_size).map_err(|e| {
error!(
?self,
?e,
"no memory available to allocate zero buffer"
);
// write zero to the first 8MB which wipes the metadata and the
// first 4MB of the data partition
let wipe_size =
std::cmp::min(self.as_bdev().size_in_bytes(), WIPE_SUPER_LEN);
hdl.write_zeroes_at(0, wipe_size).await.map_err(|e| {
error!(?self, ?e);
Error::RepDestroy {
source: Errno::ENOMEM,
source: Errno::EIO,
name: self.name(),
msg: "no memory available to allocate zero buffer".into(),
msg: "failed to write to lvol".into(),
}
})?;
// write zero to the first 8MB which wipes the metadata and the
// first 4MB of the data partition
let range =
std::cmp::min(self.as_bdev().size_in_bytes(), WIPE_SUPER_LEN);
for offset in 0 .. (range / buf_size) {
hdl.write_at(offset * buf.len(), &buf).await.map_err(|e| {
error!(?self, ?e);
Error::RepDestroy {
source: Errno::EIO,
name: self.name(),
msg: "failed to write to lvol".into(),
}
})?;
}
}
Ok(())
}
Expand Down
2 changes: 2 additions & 0 deletions io-engine/src/lvs/lvs_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -756,6 +756,8 @@ impl Lvs {
})
.map(Lvol::from_inner_ptr)?;

info!("{:?}: wiping super", lvol);

if let Err(error) = lvol.wipe_super().await {
// If we fail to destroy it hopefully the control-plane will clean
// it up, though it's possible it may attempt to use it...
Expand Down
11 changes: 8 additions & 3 deletions scripts/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,10 @@ if [ -n "$TAG" ] && [ "$TAG" != "$(get_tag)" ]; then
# Set the TAG which basically allows building the binaries as if it were a git tag
NIX_TAG_ARGS="--argstr tag $TAG"
NIX_BUILD="$NIX_BUILD $NIX_TAG_ARGS"
alias_tag=
fi
TAG=${TAG:-$HASH}
if [ -n "$OVERRIDE_COMMIT_HASH" ]; then
if [ -n "$OVERRIDE_COMMIT_HASH" ] && [ -n "$alias_tag" ]; then
# Set the TAG to the alias and remove the alias
NIX_TAG_ARGS="--argstr img_tag $alias_tag"
NIX_BUILD="$NIX_BUILD $NIX_TAG_ARGS"
Expand All @@ -169,8 +170,12 @@ fi
for name in $IMAGES; do
image_basename="openebs/${name}"
image=$image_basename
if [ -n "$REGISTRY" ]; then
image="${REGISTRY}/${image}"
if [ -n "$REGISTRY" ]; then
if [[ "${REGISTRY}" =~ '/' ]]; then
image="${REGISTRY}/$(echo ${image} | cut -d'/' -f2)"
else
image="${REGISTRY}/${image}"
fi
fi
# If we're skipping the build, then we just want to upload
# the images we already have locally.
Expand Down