mirror of
https://codeberg.org/icewind/netnsd.git
synced 2026-06-03 17:14:06 +02:00
use lazy unmount for namespaces
This commit is contained in:
parent
ac98bcbc00
commit
645a6e9978
1 changed files with 2 additions and 2 deletions
|
|
@ -6,7 +6,7 @@ use crate::daemon::namespace::raw::{
|
||||||
NamespaceSetupError, create_network_namespace,
|
NamespaceSetupError, create_network_namespace,
|
||||||
};
|
};
|
||||||
use nix::errno::Errno;
|
use nix::errno::Errno;
|
||||||
use nix::mount::{MsFlags, mount, umount};
|
use nix::mount::{MsFlags, mount, umount2, MntFlags};
|
||||||
use std::fs::{File, create_dir_all, remove_file};
|
use std::fs::{File, create_dir_all, remove_file};
|
||||||
use std::io::{Error as IoError, ErrorKind};
|
use std::io::{Error as IoError, ErrorKind};
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
|
|
@ -77,7 +77,7 @@ impl Drop for NetNs {
|
||||||
fn drop(&mut self) {
|
fn drop(&mut self) {
|
||||||
let name = self.path.file_name().unwrap().to_str().unwrap();
|
let name = self.path.file_name().unwrap().to_str().unwrap();
|
||||||
info!(name, "deleting network namespace");
|
info!(name, "deleting network namespace");
|
||||||
if let Err(error) = umount(&self.path) {
|
if let Err(error) = umount2(&self.path, MntFlags::MNT_DETACH) {
|
||||||
error!(%error, path = %self.path.display(), "Failed to unmount network namespace");
|
error!(%error, path = %self.path.display(), "Failed to unmount network namespace");
|
||||||
}
|
}
|
||||||
if let Err(error) = remove_file(&self.path) {
|
if let Err(error) = remove_file(&self.path) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue