aboutsummaryrefslogtreecommitdiff
path: root/weed/mount/filehandle.go
diff options
context:
space:
mode:
Diffstat (limited to 'weed/mount/filehandle.go')
-rw-r--r--weed/mount/filehandle.go11
1 files changed, 6 insertions, 5 deletions
diff --git a/weed/mount/filehandle.go b/weed/mount/filehandle.go
index 4595764ee..5d1552ce6 100644
--- a/weed/mount/filehandle.go
+++ b/weed/mount/filehandle.go
@@ -77,6 +77,10 @@ func (fh *FileHandle) AddChunks(chunks []*filer_pb.FileChunk) {
fh.entryLock.Lock()
defer fh.entryLock.Unlock()
+ if fh.entry == nil {
+ return
+ }
+
// find the earliest incoming chunk
newChunks := chunks
earliestChunk := newChunks[0]
@@ -86,10 +90,6 @@ func (fh *FileHandle) AddChunks(chunks []*filer_pb.FileChunk) {
}
}
- if fh.entry == nil {
- return
- }
-
// pick out-of-order chunks from existing chunks
for _, chunk := range fh.entry.Chunks {
if lessThan(earliestChunk, chunk) {
@@ -110,7 +110,8 @@ func (fh *FileHandle) AddChunks(chunks []*filer_pb.FileChunk) {
func (fh *FileHandle) CloseReader() {
if fh.reader != nil {
- fh.reader.Close()
+ _ = fh.reader.Close()
+ fh.reader = nil
}
}