aboutsummaryrefslogtreecommitdiff
path: root/weed/filesys
diff options
context:
space:
mode:
authorshibinbin <shibinbin@megvii.com>2020-06-11 11:14:31 +0800
committershibinbin <shibinbin@megvii.com>2020-06-11 11:14:31 +0800
commit29a4c3944eeb07434060df52dfb1d3cf4c59dc91 (patch)
tree45dd99cb3b58571372053ff79597259b707f6259 /weed/filesys
parent40334bc28d3fa694ce59b4e65077efb845264d20 (diff)
parentb9365de47b04414e704cb62a3cfa9753e8c5ec0c (diff)
downloadseaweedfs-29a4c3944eeb07434060df52dfb1d3cf4c59dc91.tar.xz
seaweedfs-29a4c3944eeb07434060df52dfb1d3cf4c59dc91.zip
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'weed/filesys')
-rw-r--r--weed/filesys/filehandle.go5
-rw-r--r--weed/filesys/wfs.go1
2 files changed, 6 insertions, 0 deletions
diff --git a/weed/filesys/filehandle.go b/weed/filesys/filehandle.go
index 372d742ea..c6637259d 100644
--- a/weed/filesys/filehandle.go
+++ b/weed/filesys/filehandle.go
@@ -3,6 +3,7 @@ package filesys
import (
"context"
"fmt"
+ "io"
"math"
"net/http"
"time"
@@ -98,6 +99,10 @@ func (fh *FileHandle) readFromChunks(buff []byte, offset int64) (int64, error) {
totalRead, err := fh.f.reader.ReadAt(buff, offset)
+ if err == io.EOF {
+ err = nil
+ }
+
if err != nil {
glog.Errorf("file handle read %s: %v", fh.f.fullpath(), err)
}
diff --git a/weed/filesys/wfs.go b/weed/filesys/wfs.go
index 67dd2a62c..2b0ef64c2 100644
--- a/weed/filesys/wfs.go
+++ b/weed/filesys/wfs.go
@@ -89,6 +89,7 @@ func NewSeaweedFileSystem(option *Option) *WFS {
},
}
if option.CacheSizeMB > 0 {
+ os.MkdirAll(option.CacheDir, 0755)
wfs.chunkCache = chunk_cache.NewChunkCache(256, option.CacheDir, option.CacheSizeMB)
grace.OnInterrupt(func() {
wfs.chunkCache.Shutdown()