From c6fe0799445e25a8fc929143c2ccb8929dda55c6 Mon Sep 17 00:00:00 2001 From: Niladri Halder Date: Wed, 21 Feb 2024 16:52:03 +0000 Subject: [PATCH 1/2] chore(deps): update mayastor-dependencies gitmodule Signed-off-by: Niladri Halder --- utils/dependencies | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/dependencies b/utils/dependencies index efb8d4caf..510e8ea57 160000 --- a/utils/dependencies +++ b/utils/dependencies @@ -1 +1 @@ -Subproject commit efb8d4caf9d40024a50bf6d69efdffd9c0286bd0 +Subproject commit 510e8ea57b3c2e9977448163d60277d3e45c3a50 From 9dee1de250f78fc575a31ebcf928985dd1584767 Mon Sep 17 00:00:00 2001 From: Niladri Halder Date: Wed, 21 Feb 2024 17:30:40 +0000 Subject: [PATCH 2/2] refactor(io-engine): use SafeMountIter instead of proc_mounts::MountIter Ref: https://github.com/openebs/mayastor-dependencies/pull/65 Signed-off-by: Niladri Halder --- Cargo.lock | 25 +++---------------------- io-engine-tests/Cargo.toml | 1 - io-engine/Cargo.toml | 2 +- io-engine/src/host/blk_device.rs | 7 +++---- 4 files changed, 7 insertions(+), 28 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 704bb4734..bab8080e1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1591,6 +1591,7 @@ dependencies = [ "colored_json", "crossbeam", "derive_builder", + "devinfo", "env_logger", "etcd-client", "event-publisher", @@ -1616,7 +1617,6 @@ dependencies = [ "once_cell", "parking_lot", "pin-utils", - "proc-mounts", "prost", "prost-derive", "rand", @@ -1729,7 +1729,6 @@ dependencies = [ "once_cell", "parking_lot", "pin-utils", - "proc-mounts", "prost", "prost-derive", "rand", @@ -2200,15 +2199,6 @@ dependencies = [ "windows-targets", ] -[[package]] -name = "partition-identity" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fa925f9becb532d758b0014b472c576869910929cf4c3f8054b386f19ab9e21" -dependencies = [ - "thiserror", -] - [[package]] name = "peeking_take_while" version = "0.1.2" @@ -2387,15 +2377,6 @@ dependencies = [ "unicode-ident", ] -[[package]] -name = "proc-mounts" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d652f8435d0ab70bf4f3590a6a851d59604831a458086541b95238cc51ffcf2" -dependencies = [ - "partition-identity", -] - [[package]] name = "prost" version = "0.12.1" @@ -2772,9 +2753,9 @@ dependencies = [ [[package]] name = "semver" -version = "1.0.21" +version = "1.0.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b97ed7a9823b74f99c7742f5336af7be5ecd3eeafcb1507d1fa93347b1d589b0" +checksum = "92d43fe69e652f3df9bdc2b85b2854a0825b86e4fb76bc44d945137d053639ca" [[package]] name = "serde" diff --git a/io-engine-tests/Cargo.toml b/io-engine-tests/Cargo.toml index 67f21ebbc..d48861554 100644 --- a/io-engine-tests/Cargo.toml +++ b/io-engine-tests/Cargo.toml @@ -33,7 +33,6 @@ nix = "0.27.1" once_cell = "1.18.0" parking_lot = "0.12.1" pin-utils = "0.1.0" -proc-mounts = "0.3.0" prost = "0.12.1" prost-derive = "0.12.1" rand = "0.8.5" diff --git a/io-engine/Cargo.toml b/io-engine/Cargo.toml index e1a0a3b14..1040ab32b 100644 --- a/io-engine/Cargo.toml +++ b/io-engine/Cargo.toml @@ -73,7 +73,6 @@ nix = { version = "0.27.1", default-features = false, features = [ "hostname", " once_cell = "1.18.0" parking_lot = "0.12.1" pin-utils = "0.1.0" -proc-mounts = "0.3.0" prost = "0.12.1" prost-derive = "0.12.1" rand = "0.8.5" @@ -98,6 +97,7 @@ async-process = { version = "1.8.1" } rstack = { version = "0.3.3" } tokio-stream = "0.1.14" +devinfo = { path = "../utils/dependencies/devinfo" } jsonrpc = { path = "../jsonrpc"} io-engine-api = { path = "../utils/dependencies/apis/io-engine" } spdk-rs = { path = "../spdk-rs" } diff --git a/io-engine/src/host/blk_device.rs b/io-engine/src/host/blk_device.rs index d9a36c0aa..f6b019703 100644 --- a/io-engine/src/host/blk_device.rs +++ b/io-engine/src/host/blk_device.rs @@ -21,14 +21,13 @@ //! of consistency, the mount table is also checked to ENSURE that the device //! is not mounted) +use crate::constants::{NEXUS_CAS_DRIVER, NVME_CONTROLLER_MODEL_ID}; +use devinfo::mountinfo::{MountInfo, SafeMountIter}; use std::{ collections::HashMap, ffi::{OsStr, OsString}, io::Error, }; - -use crate::constants::{NEXUS_CAS_DRIVER, NVME_CONTROLLER_MODEL_ID}; -use proc_mounts::{MountInfo, MountIter}; use udev::{Device, Enumerator}; // Struct representing a property value in a udev::Device struct (and possibly @@ -278,7 +277,7 @@ fn new_device( fn get_mounts() -> Result>, Error> { let mut table: HashMap> = HashMap::new(); - for mount in (MountIter::new()?).flatten() { + for mount in SafeMountIter::get()?.flatten() { let mount_source = OsString::from(mount.source.clone()); if !table.contains_key(&mount_source) { table.insert(mount_source.clone(), Vec::new());