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 { ...@@ -343,15 +343,25 @@ func (c *FileSystemConnector) Unmount(node *Inode) fuse.Status {
mount.treeLock.Unlock() mount.treeLock.Unlock()
parentNode.mount.treeLock.Unlock() parentNode.mount.treeLock.Unlock()
delay := 100 * time.Microsecond delay := 100 * time.Microsecond
for { for {
// This operation is rare, so we kludge it to avoid // This operation is rare, so we kludge it to avoid
// contention. // contention.
time.Sleep(delay) time.Sleep(delay)
delay = delay*2 + 1 delay = delay*2
if !c.inodeMap.Has(nodeId) { if !c.inodeMap.Has(nodeId) {
break 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() parentNode.mount.treeLock.Lock()
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