pub fn umount(&self, path: &str) -> Result<()> {
        // Serialize mount operations. Do not expect poisoned lock here.
        let _guard = self.lock.lock().unwrap();
        let inode = self.root.path_walk(path)?;

        let mut mountpoints = self.mountpoints.load().deref().deref().clone();
        let fs_super_index = mountpoints
            .get(&inode)
            .map(Arc::clone)
            .map(|x| {
                self.root.evict_inode(inode);
                mountpoints.remove(&inode);
                self.mountpoints.store(Arc::new(mountpoints));
                x.super_index
            })
            .ok_or_else(|| {
                error!("{} is not a mount point.", path);
                Error::from_raw_os_error(libc::EINVAL)
            })?;

        trace!("fs_super_index {}", fs_super_index);

        let inodes: Vec<u64> = self
            .inodes
            .read()
            .unwrap()
            .iter()
            .filter(|(_, &idata)| idata.super_index == fs_super_index)
            .map(|(&a, _)| a)
            .collect();
        trace!(
            "number of inode of index {} is {}",
            fs_super_index,
            inodes.len()
        );
        let mut vfsinodes = self.inodes.write().unwrap();
        for inode in inodes.iter() {
            vfsinodes.remove_by_left(inode);
        }

        let mut superblocks = self.superblocks.load().deref().deref().clone();
        let fs = superblocks.get(&fs_super_index).map(Arc::clone).unwrap();
        fs.destroy();
        superblocks.remove(&fs_super_index);
        self.superblocks.store(Arc::new(superblocks));
        Ok(())
    }
/// Umount a backend file system at path
Umount a backend file system at path
Umount a backend file system at path
pub fn umount(&self, path: &str) -> Result<()> {
        // Serialize mount operations. Do not expect poisoned lock here.
        let _guard = self.lock.lock().unwrap();
        let inode = self.root.path_walk(path)?;
        let mut mountpoints = self.mountpoints.load().deref().deref().clone();
        let fs_super_index = mountpoints
            .get(&inode)
            .map(Arc::clone)
            .map(|x| {
                self.root.evict_inode(inode);
                mountpoints.remove(&inode);
                self.mountpoints.store(Arc::new(mountpoints));
                x.super_index
            })
            .ok_or_else(|| {
                error!("{} is not a mount point.", path);
                Error::from_raw_os_error(libc::EINVAL)
            })?;
        trace!("fs_super_index {}", fs_super_index);
        let inodes: Vec<u64> = self
            .inodes
            .read()
            .unwrap()
            .iter()
            .filter(|(_, &idata)| idata.super_index == fs_super_index)
            .map(|(&a, _)| a)
            .collect();
        trace!(
            "number of inode of index {} is {}",
            fs_super_index,
            inodes.len()
        );
        let mut vfsinodes = self.inodes.write().unwrap();
        for inode in inodes.iter() {
            vfsinodes.remove_by_left(inode);
        }
        let mut superblocks = self.superblocks.load().deref().deref().clone();
        let fs = superblocks.get(&fs_super_index).map(Arc::clone).unwrap();
        fs.destroy();
        superblocks.remove(&fs_super_index);
        self.superblocks.store(Arc::new(superblocks));
        Ok(())
    }
pub fn umount ( & self , path : & str ) -> Result < ( ) > { // Serialize mount operations. Do not expect poisoned lock here. let _guard = self . lock . lock ( ) . unwrap ( ) ; let inode = self . root . path_walk ( path ) ? ; let mut mountpoints = self . mountpoints . load ( ) . deref ( ) . deref ( ) . clone ( ) ; let fs_super_index = mountpoints . get ( & inode ) . map ( Arc :: clone ) . map ( | x | { self . root . evict_inode ( inode ) ; mountpoints . remove ( & inode ) ; self . mountpoints . store ( Arc :: new ( mountpoints ) ) ; x . super_index } ) . ok_or_else ( | | { error ! ( " " path ) ; Error :: from_raw_os_error ( libc :: EINVAL ) } ) ? ; trace ! ( " " fs_super_index ) ; let inodes : Vec < u64 > = self . inodes . read ( ) . unwrap ( ) . iter ( ) . filter ( | ( _ , & idata ) | idata . super_index == fs_super_index ) . map ( | ( & a , _ ) | a ) . collect ( ) ; trace ! ( " " fs_super_index inodes len ( ) ) ; let mut vfsinodes = self . inodes . write ( ) . unwrap ( ) ; for inode in inodes . iter ( ) { vfsinodes . remove_by_left ( inode ) ; } let mut superblocks = self . superblocks . load ( ) . deref ( ) . deref ( ) . clone ( ) ; let fs = superblocks . get ( & fs_super_index ) . map ( Arc :: clone ) . unwrap ( ) ; fs . destroy ( ) ; superblocks . remove ( & fs_super_index ) ; self . superblocks . store ( Arc :: new ( superblocks ) ) ; Ok ( ( ) ) }
Umount a backend file system at path
Umount a backend file system at path
&self
path
&str
&self
path
&str