diff --git a/io-engine/src/lvs/lvs_lvol.rs b/io-engine/src/lvs/lvs_lvol.rs index 18d9a9e8df..7e11ed1a5e 100644 --- a/io-engine/src/lvs/lvs_lvol.rs +++ b/io-engine/src/lvs/lvs_lvol.rs @@ -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}; @@ -294,34 +293,16 @@ 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 + hdl.write_zeroes_at(0, WIPE_SUPER_LEN).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(()) } diff --git a/io-engine/src/lvs/lvs_store.rs b/io-engine/src/lvs/lvs_store.rs index 865f9c2055..3c35c14325 100644 --- a/io-engine/src/lvs/lvs_store.rs +++ b/io-engine/src/lvs/lvs_store.rs @@ -756,6 +756,8 @@ impl Lvs { }) .map(Lvol::from_inner_ptr)?; + info!("{:?}: wipping 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...