Skip to content

Commit

Permalink
chore(bors): merge pull request #749
Browse files Browse the repository at this point in the history
749: refactor(csi-driver): replace MountIters with SafeMountIters r=niladrih a=niladrih

Changes:
- Replaces MountIters with SafeMountIters.

Ref:
- openebs/mayastor-dependencies#65
- openebs/mayastor#1591

Co-authored-by: Niladri Halder <niladri.halder26@gmail.com>
  • Loading branch information
mayastor-bors and niladrih committed Feb 20, 2024
2 parents 9380531 + 4884741 commit efdc30e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
6 changes: 4 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions control-plane/csi-driver/src/bin/node/mount.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Utility functions for mounting and unmounting filesystems.
use crate::filesystem_ops::FileSystem;
use csi_driver::filesystem::FileSystem as Fs;
use devinfo::mountinfo::{MountInfo, MountIter};
use devinfo::mountinfo::{MountInfo, SafeMountIter};

use std::{collections::HashSet, io::Error};
use sys_mount::{unmount, FilesystemType, Mount, MountFlags, UnmountFlags};
Expand Down Expand Up @@ -31,7 +31,7 @@ impl ReadOnly for &str {
pub(crate) fn find_mount(source: Option<&str>, target: Option<&str>) -> Option<MountInfo> {
let mut found: Option<MountInfo> = None;

for mount in MountIter::new().unwrap().flatten() {
for mount in SafeMountIter::get().unwrap().flatten() {
if let Some(value) = source {
if mount.source.to_string_lossy() == value {
if let Some(value) = target {
Expand All @@ -57,7 +57,7 @@ pub(crate) fn find_mount(source: Option<&str>, target: Option<&str>) -> Option<M
/// Return all mounts for a matching source.
/// Optionally ignore the given destination path.
pub(crate) fn find_src_mounts(source: &str, dest_ignore: Option<&str>) -> Vec<MountInfo> {
MountIter::new()
SafeMountIter::get()
.unwrap()
.flatten()
.filter(|mount| {
Expand Down

0 comments on commit efdc30e

Please sign in to comment.