Skip to content

Commit

Permalink
fix mount and umount
Browse files Browse the repository at this point in the history
  • Loading branch information
luanshaotong committed Jul 27, 2023
1 parent 3b53aaa commit 6111483
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
11 changes: 10 additions & 1 deletion src/client/daemon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use std::{
use async_trait::async_trait;
use dashmap::DashMap;
use fuser::{BackgroundSession, MountOption};
use log::{error, info};
use log::{error, info, warn};

use crate::{
common::{
Expand Down Expand Up @@ -145,6 +145,15 @@ impl SealfsFused {
let volume_name = lines[i * 4 + 1].to_owned();
let read_only = lines[i * 4 + 2].parse::<bool>().unwrap();
info!("mounting volume {} to {}", volume_name, mountpoint);

// umount old mountpoint
if let Err(e) = std::process::Command::new("umount")
.arg(&mountpoint)
.output()
{
warn!("umount {} error: {}", &mountpoint, e);
}

match self.mount(mountpoint, volume_name.clone(), read_only).await {
Ok(_) => {
info!("mount success");
Expand Down
6 changes: 3 additions & 3 deletions src/client/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ enum Commands {
#[arg(required = true, name = "mount-point")]
mount_point: Option<String>,

#[arg(name = "socket-path")]
#[arg(long = "socket-path", name = "socket-path")]
socket_path: Option<String>,
},
Add {
Expand Down Expand Up @@ -139,7 +139,7 @@ enum Commands {
manager_address: Option<String>,
},
ListMountpoints {
#[arg(name = "socket-path")]
#[arg(long = "socket-path", name = "socket-path")]
socket_path: Option<String>,
},
Status {
Expand All @@ -148,7 +148,7 @@ enum Commands {
manager_address: Option<String>,
},
Probe {
#[arg(name = "socket-path")]
#[arg(long = "socket-path", name = "socket-path")]
socket_path: Option<String>,
// Probe the local client
},
Expand Down

0 comments on commit 6111483

Please sign in to comment.