mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
mount: avoid "send on closed channel"
This commit is contained in:
parent
9d80a3428c
commit
09bab17aff
|
@ -14,6 +14,7 @@ type ContinuousDirtyPages struct {
|
||||||
f *File
|
f *File
|
||||||
writeWaitGroup sync.WaitGroup
|
writeWaitGroup sync.WaitGroup
|
||||||
chunkSaveErrChan chan error
|
chunkSaveErrChan chan error
|
||||||
|
chunkSaveErrChanClosed bool
|
||||||
lock sync.Mutex
|
lock sync.Mutex
|
||||||
collection string
|
collection string
|
||||||
replication string
|
replication string
|
||||||
|
@ -82,6 +83,11 @@ func (pages *ContinuousDirtyPages) saveExistingLargestPageToStorage() (hasSavedD
|
||||||
|
|
||||||
func (pages *ContinuousDirtyPages) saveToStorage(reader io.Reader, offset int64, size int64) {
|
func (pages *ContinuousDirtyPages) saveToStorage(reader io.Reader, offset int64, size int64) {
|
||||||
|
|
||||||
|
if pages.chunkSaveErrChanClosed {
|
||||||
|
pages.chunkSaveErrChan = make(chan error, 8)
|
||||||
|
pages.chunkSaveErrChanClosed = false
|
||||||
|
}
|
||||||
|
|
||||||
mtime := time.Now().UnixNano()
|
mtime := time.Now().UnixNano()
|
||||||
pages.writeWaitGroup.Add(1)
|
pages.writeWaitGroup.Add(1)
|
||||||
go func() {
|
go func() {
|
||||||
|
|
|
@ -186,6 +186,7 @@ func (fh *FileHandle) Release(ctx context.Context, req *fuse.ReleaseRequest) err
|
||||||
}
|
}
|
||||||
|
|
||||||
// stop the goroutine
|
// stop the goroutine
|
||||||
|
fh.dirtyPages.chunkSaveErrChanClosed = true
|
||||||
close(fh.dirtyPages.chunkSaveErrChan)
|
close(fh.dirtyPages.chunkSaveErrChan)
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|
Loading…
Reference in a new issue