mount: leave the meta cache open when the shutdown flush times out

A flush still running after the 30s bound holds its handle's lock.
Closing the meta cache drains queued invalidations, and one for that
handle waits on the same lock, so the hook blocked past its bound
until the flush gave up. Skip the close in that case, as the write
cache removal already is; the process exits right after the hooks.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Chris LuandClaude Opus 5.5 committed 2026-12-04 01:31:42 -08:00
1 parent a5877b3d62
commit e6f084bbaf
1 file changed
+4 -2
+4 -2
View File
@@ -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())