Commit 646ae57a authored by Han-Wen Nienhuys's avatar Han-Wen Nienhuys

Only forget inode if inode.mountPoint == nil.

Previously, a FORGET opcode could force a mount that was unused to be
forgotten.  This would cause the mounting filesystem to get into
inconsistent states: MultiZipFs and AutoUnionFs would believe the
mount is still live, but FilesystemConnector had already forgotten it.

The downside to this solution is that submount FileSystems will no
longer be unmounted if the root FileSystem is unmounted with
"fusermount -u".
parent 0a349536
......@@ -397,13 +397,9 @@ func (me *FileSystemConnector) considerDropInode(n *inode) {
n.OpenCountMutex.Lock()
defer n.OpenCountMutex.Unlock()
dropInode := n.LookupCount <= 0 && len(n.Children) == 0 &&
n.OpenCount <= 0 && n != me.rootNode
n.OpenCount <= 0 && n != me.rootNode && n.mountPoint == nil
if dropInode {
if n.mountPoint != nil {
me.unsafeUnmountNode(n)
} else {
n.setParent(nil)
}
n.setParent(nil)
if n != me.rootNode {
me.inodeMap.Forget(n.NodeId)
}
......@@ -492,6 +488,11 @@ func EmptyFileSystemConnector() (me *FileSystemConnector) {
// ENOENT: the directory containing the mount point does not exist.
//
// EBUSY: the intended mount point already exists.
//
// TODO - would be useful to expose an interface to put all of the
// mount management in FileSystemConnector, so AutoUnionFs and
// MultiZipFs don't have to do it separately, with the risk of
// inconsistencies.
func (me *FileSystemConnector) Mount(mountPoint string, fs FileSystem, opts *FileSystemOptions) Status {
if mountPoint == "/" || mountPoint == "" {
me.mountRoot(fs, opts)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment