Commit 4673f8b4 authored by Han-Wen Nienhuys's avatar Han-Wen Nienhuys

Make considerDropInode() in FileSystemConnector.ReleaseDir() take the

treeLock.
parent 2003d2b2
......@@ -134,13 +134,22 @@ func (me *FileSystemConnector) forgetUpdate(nodeId uint64, forgetCount int) {
defer node.treeLock.Unlock()
node.addLookupCount(-forgetCount)
me.considerDropInode(node)
me.recursiveConsiderDropInode(node)
}
func (me *FileSystemConnector) considerDropInode(n *Inode) (drop bool) {
func (me *FileSystemConnector) considerDropInode(node *Inode) {
node.treeLock.Lock()
defer node.treeLock.Unlock()
me.recursiveConsiderDropInode(node)
}
// Must hold treeLock.
func (me *FileSystemConnector) recursiveConsiderDropInode(n *Inode) (drop bool) {
delChildren := []string{}
for k, v := range n.children {
if v.mountPoint == nil && me.considerDropInode(v) {
// Only consider children from the same mount, or
// already unmounted mountpoints.
if v.mountPoint == nil && me.recursiveConsiderDropInode(v) {
delChildren = append(delChildren, k)
}
}
......
......@@ -334,8 +334,8 @@ func (me *FileSystemConnector) Create(header *InHeader, input *CreateIn, name st
func (me *FileSystemConnector) Release(header *InHeader, input *ReleaseIn) {
node := me.getInodeData(header.NodeId)
me.getOpenedFile(input.Fh).WithFlags.File.Release()
node.mount.unregisterFileHandle(input.Fh, node)
opened := node.mount.unregisterFileHandle(input.Fh, node)
opened.WithFlags.File.Release()
}
func (me *FileSystemConnector) Flush(header *InHeader, input *FlushIn) 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