diff options
| author | Chris Lu <chris.lu@gmail.com> | 2020-06-08 08:49:57 -0700 |
|---|---|---|
| committer | Chris Lu <chris.lu@gmail.com> | 2020-06-08 08:49:57 -0700 |
| commit | bb3e86fbd5b2e0ec17b496a3ca3904cd63ce0521 (patch) | |
| tree | 876b5428d52e2ef3aab5a728cc0ec21355e3a81d | |
| parent | bdbe5ddbe9cd46ec7a931407e0bc33a2f8d0c9b1 (diff) | |
| download | seaweedfs-bb3e86fbd5b2e0ec17b496a3ca3904cd63ce0521.tar.xz seaweedfs-bb3e86fbd5b2e0ec17b496a3ca3904cd63ce0521.zip | |
auto create non-existing cache directory
fix https://github.com/chrislusf/seaweedfs/issues/1350
| -rw-r--r-- | weed/filesys/wfs.go | 1 | ||||
| -rw-r--r-- | weed/util/file_util.go | 4 |
2 files changed, 5 insertions, 0 deletions
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() diff --git a/weed/util/file_util.go b/weed/util/file_util.go index bef9f7cd6..ff725830b 100644 --- a/weed/util/file_util.go +++ b/weed/util/file_util.go @@ -49,6 +49,10 @@ func CheckFile(filename string) (exists, canRead, canWrite bool, modTime time.Ti exists = false return } + if err != nil { + glog.Errorf("check %s: %v", filename, err) + return + } if fi.Mode()&0400 != 0 { canRead = true } |
