Commit b40418c2 authored by Han-Wen Nienhuys's avatar Han-Wen Nienhuys

In FileSystemConnector.createChild(), only create a child if the

FsNode has no Inode.

If not (in case of hardlink), increase the lookupCount for the inode.
parent 7d6773d7
...@@ -73,7 +73,15 @@ func (me *FileSystemConnector) newInode(isDir bool) *Inode { ...@@ -73,7 +73,15 @@ func (me *FileSystemConnector) newInode(isDir bool) *Inode {
} }
func (me *FileSystemConnector) createChild(parent *Inode, name string, fi *os.FileInfo, fsi FsNode) (out *EntryOut, child *Inode) { func (me *FileSystemConnector) createChild(parent *Inode, name string, fi *os.FileInfo, fsi FsNode) (out *EntryOut, child *Inode) {
if fsi.Inode() == nil {
child = parent.CreateChild(name, fi.IsDirectory(), fsi) child = parent.CreateChild(name, fi.IsDirectory(), fsi)
} else {
parent.treeLock.Lock()
defer parent.treeLock.Unlock()
child = fsi.Inode()
child.addLookupCount(1)
}
out = parent.mount.fileInfoToEntry(fi) out = parent.mount.fileInfoToEntry(fi)
out.Ino = child.nodeId out.Ino = child.nodeId
out.NodeId = child.nodeId out.NodeId = child.nodeId
......
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