Commit 4bc4f55c authored by Han-Wen Nienhuys's avatar Han-Wen Nienhuys

Maybe drop inode on closing file as well.

parent 6ff9f82d
...@@ -279,17 +279,21 @@ func (me *PathFileSystemConnector) forgetUpdate(nodeId uint64, forgetCount int) ...@@ -279,17 +279,21 @@ func (me *PathFileSystemConnector) forgetUpdate(nodeId uint64, forgetCount int)
data, ok := me.inodeMap[nodeId] data, ok := me.inodeMap[nodeId]
if ok { if ok {
data.LookupCount -= forgetCount data.LookupCount -= forgetCount
me.considerDropInode(data)
}
}
if data.mount != nil { func (me *PathFileSystemConnector) considerDropInode(n *inode) {
data.mount.mutex.RLock() if n.mount != nil {
defer data.mount.mutex.RUnlock() n.mount.mutex.RLock()
defer n.mount.mutex.RUnlock()
} }
// TODO - this should probably not happen at all. // TODO - this should probably not happen at all.
if data.LookupCount <= 0 && len(data.Children) == 0 && (data.mount == nil || data.mount.unmountPending) { if (n.LookupCount <= 0 && len(n.Children) == 0 && (n.mount == nil || n.mount.unmountPending) &&
data.setParent(nil) n.OpenCount <= 0) {
me.inodeMap[nodeId] = nil, false n.setParent(nil)
} me.inodeMap[n.NodeId] = nil, false
} }
} }
...@@ -769,12 +773,14 @@ func (me *PathFileSystemConnector) Release(header *InHeader, input *ReleaseIn) { ...@@ -769,12 +773,14 @@ func (me *PathFileSystemConnector) Release(header *InHeader, input *ReleaseIn) {
_, _, node := me.GetPath(header.NodeId) _, _, node := me.GetPath(header.NodeId)
f := me.unregisterFile(node, input.Fh).(FuseFile) f := me.unregisterFile(node, input.Fh).(FuseFile)
f.Release() f.Release()
me.considerDropInode(node)
} }
func (me *PathFileSystemConnector) ReleaseDir(header *InHeader, input *ReleaseIn) { func (me *PathFileSystemConnector) ReleaseDir(header *InHeader, input *ReleaseIn) {
_, _, node := me.GetPath(header.NodeId) _, _, node := me.GetPath(header.NodeId)
d := me.unregisterFile(node, input.Fh).(RawFuseDir) d := me.unregisterFile(node, input.Fh).(RawFuseDir)
d.Release() d.Release()
me.considerDropInode(node)
} }
func (me *PathFileSystemConnector) FsyncDir(header *InHeader, input *FsyncIn) (code Status) { func (me *PathFileSystemConnector) FsyncDir(header *InHeader, input *FsyncIn) (code Status) {
......
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