diff options
Diffstat (limited to 'weed')
| -rw-r--r-- | weed/mount/filehandle.go | 8 | ||||
| -rw-r--r-- | weed/mount/weedfs_file_read.go | 4 |
2 files changed, 6 insertions, 6 deletions
diff --git a/weed/mount/filehandle.go b/weed/mount/filehandle.go index b2459d9e2..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) { diff --git a/weed/mount/weedfs_file_read.go b/weed/mount/weedfs_file_read.go index 0375bc206..307ad5960 100644 --- a/weed/mount/weedfs_file_read.go +++ b/weed/mount/weedfs_file_read.go @@ -39,8 +39,8 @@ func (wfs *WFS) Read(cancel <-chan struct{}, in *fuse.ReadIn, buff []byte) (fuse return nil, fuse.ENOENT } - fh.entryLock.Lock() - defer fh.entryLock.Unlock() + fh.Lock() + defer fh.Unlock() offset := int64(in.Offset) totalRead, err := readDataByFileHandle(buff, fh, offset) |
