From ad652ffb97cfdf6d866352a37992ece1c1870248 Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Tue, 20 Oct 2020 22:54:34 -0700 Subject: [PATCH] avoid close closed channel --- weed/filesys/filehandle.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/weed/filesys/filehandle.go b/weed/filesys/filehandle.go index 0304eebb4..412d7e73f 100644 --- a/weed/filesys/filehandle.go +++ b/weed/filesys/filehandle.go @@ -185,8 +185,10 @@ func (fh *FileHandle) Release(ctx context.Context, req *fuse.ReleaseRequest) err } // stop the goroutine - fh.dirtyPages.chunkSaveErrChanClosed = true - close(fh.dirtyPages.chunkSaveErrChan) + if !fh.dirtyPages.chunkSaveErrChanClosed { + fh.dirtyPages.chunkSaveErrChanClosed = true + close(fh.dirtyPages.chunkSaveErrChan) + } return nil }