mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
ensure releasing file handle
This commit is contained in:
parent
8136384473
commit
3aeee3d748
|
@ -88,6 +88,10 @@ func (fh *FileHandle) addChunks(chunks []*filer_pb.FileChunk) {
|
||||||
fh.chunkAddLock.Unlock()
|
fh.chunkAddLock.Unlock()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (fh *FileHandle) Release() {
|
||||||
|
fh.dirtyPages.Destroy()
|
||||||
|
}
|
||||||
|
|
||||||
func lessThan(a, b *filer_pb.FileChunk) bool {
|
func lessThan(a, b *filer_pb.FileChunk) bool {
|
||||||
if a.Mtime == b.Mtime {
|
if a.Mtime == b.Mtime {
|
||||||
return a.Fid.FileKey < b.Fid.FileKey
|
return a.Fid.FileKey < b.Fid.FileKey
|
||||||
|
|
|
@ -61,6 +61,7 @@ func (i *FileHandleToInode) ReleaseByInode(inode uint64) {
|
||||||
if fh.counter <= 0 {
|
if fh.counter <= 0 {
|
||||||
delete(i.inode2fh, inode)
|
delete(i.inode2fh, inode)
|
||||||
delete(i.fh2inode, fh.fh)
|
delete(i.fh2inode, fh.fh)
|
||||||
|
fh.Release()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -77,6 +78,7 @@ func (i *FileHandleToInode) ReleaseByHandle(fh FileHandleId) {
|
||||||
if fhHandle.counter <= 0 {
|
if fhHandle.counter <= 0 {
|
||||||
delete(i.inode2fh, inode)
|
delete(i.inode2fh, inode)
|
||||||
delete(i.fh2inode, fhHandle.fh)
|
delete(i.fh2inode, fhHandle.fh)
|
||||||
|
fhHandle.Release()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -179,4 +179,7 @@ func (up *UploadPipeline) moveToSealed(memChunk PageChunk, logicChunkIndex Logic
|
||||||
}
|
}
|
||||||
|
|
||||||
func (up *UploadPipeline) Shutdown() {
|
func (up *UploadPipeline) Shutdown() {
|
||||||
|
for logicChunkIndex, sealedChunk := range up.sealedChunks {
|
||||||
|
sealedChunk.FreeReference(fmt.Sprintf("%s uploadpipeline shutdown chunk %d", up.filepath, logicChunkIndex))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue