Commit 97a174d5 authored by Han-Wen Nienhuys's avatar Han-Wen Nienhuys

fuse/nodefs: Limit wait on unmount to 1 second.

If we wait longer, we will probably wait indefinitely.
parent 24b6b71a
......@@ -343,15 +343,25 @@ func (c *FileSystemConnector) Unmount(node *Inode) fuse.Status {
mount.treeLock.Unlock()
parentNode.mount.treeLock.Unlock()
delay := 100 * time.Microsecond
for {
// This operation is rare, so we kludge it to avoid
// contention.
time.Sleep(delay)
delay = delay*2 + 1
delay = delay*2
if !c.inodeMap.Has(nodeId) {
break
}
if delay >= time.Second {
// We limit the wait at one second. If
// it takes longer, something else is
// amiss, and we would be waiting forever.
log.Println("kernel did not issue FORGET for node on Unmount.")
break
}
}
parentNode.mount.treeLock.Lock()
mount.treeLock.Lock()
}
......
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