diff --git a/weed/mount/weedfs.go b/weed/mount/weedfs.go index ed902d0ea8..0d29aab387 100644 --- a/weed/mount/weedfs.go +++ b/weed/mount/weedfs.go @@ -394,7 +394,9 @@ func NewSeaweedFileSystem(option *Option) *WFS { // Use a timeout to avoid hanging on Ctrl-C if the filer is // unreachable: writeback flushes retry until it answers. // If the timeout expires, skip the write-cache removal so that - // still-running goroutines can finish reading swap files. + // still-running goroutines can finish reading swap files, and leave + // the meta cache open: its invalidations wait for the handle locks + // those flushes hold. // Open files are flushed first: their buffered writes would otherwise // die with the process. asyncDrained := true @@ -415,8 +417,8 @@ func NewSeaweedFileSystem(option *Option) *WFS { } // End the metadata follow before closing the cache it writes into. wfs.stopMetadataFollow() - wfs.metaCache.Shutdown() if asyncDrained { + wfs.metaCache.Shutdown() os.RemoveAll(option.getUniqueCacheDirForWrite()) } os.RemoveAll(option.getUniqueCacheDirForRead())