aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--weed/command/mount_std.go2
-rw-r--r--weed/filer/meta_aggregator.go2
-rw-r--r--weed/filesys/dir_rename.go3
-rw-r--r--weed/filesys/meta_cache/meta_cache.go20
-rw-r--r--weed/filesys/wfs.go2
-rw-r--r--weed/topology/topology_vacuum.go2
-rw-r--r--weed/topology/volume_location_list.go8
7 files changed, 24 insertions, 15 deletions
diff --git a/weed/command/mount_std.go b/weed/command/mount_std.go
index 44e945f23..3947a871a 100644
--- a/weed/command/mount_std.go
+++ b/weed/command/mount_std.go
@@ -91,7 +91,7 @@ func RunMount(option *MountOptions, umask os.FileMode) bool {
// detect mount folder mode
if *option.dirAutoCreate {
- os.MkdirAll(dir, 0755)
+ os.MkdirAll(dir, os.FileMode(0777) &^ umask)
}
mountMode := os.ModeDir | 0755
fileInfo, err := os.Stat(dir)
diff --git a/weed/filer/meta_aggregator.go b/weed/filer/meta_aggregator.go
index 4918899ff..b90457339 100644
--- a/weed/filer/meta_aggregator.go
+++ b/weed/filer/meta_aggregator.go
@@ -78,7 +78,7 @@ func (ma *MetaAggregator) subscribeToOneFiler(f *Filer, self string, peer string
var counter int64
var synced bool
maybeReplicateMetadataChange = func(event *filer_pb.SubscribeMetadataResponse) {
- if err := Replay(f.Store.ActualStore, event); err != nil {
+ if err := Replay(f.Store, event); err != nil {
glog.Errorf("failed to reply metadata change from %v: %v", peer, err)
return
}
diff --git a/weed/filesys/dir_rename.go b/weed/filesys/dir_rename.go
index b9e9e300b..3f73d0eb6 100644
--- a/weed/filesys/dir_rename.go
+++ b/weed/filesys/dir_rename.go
@@ -23,7 +23,7 @@ func (dir *Dir) Rename(ctx context.Context, req *fuse.RenameRequest, newDirector
// find local old entry
oldEntry, err := dir.wfs.metaCache.FindEntry(context.Background(), oldPath)
if err != nil {
- glog.V(0).Infof("dir Rename can not find source %s : %v", oldPath, err)
+ glog.Errorf("dir Rename can not find source %s : %v", oldPath, err)
return fuse.ENOENT
}
@@ -41,6 +41,7 @@ func (dir *Dir) Rename(ctx context.Context, req *fuse.RenameRequest, newDirector
_, err := client.AtomicRenameEntry(ctx, request)
if err != nil {
+ glog.Errorf("dir AtomicRenameEntry %s => %s : %v", oldPath, newPath, err)
return fuse.EIO
}
diff --git a/weed/filesys/meta_cache/meta_cache.go b/weed/filesys/meta_cache/meta_cache.go
index ac193a493..06f634c72 100644
--- a/weed/filesys/meta_cache/meta_cache.go
+++ b/weed/filesys/meta_cache/meta_cache.go
@@ -17,7 +17,7 @@ import (
// e.g. fill fileId field for chunks
type MetaCache struct {
- actualStore filer.FilerStore
+ localStore filer.FilerStore
sync.RWMutex
visitedBoundary *bounded_tree.BoundedTree
uidGidMapper *UidGidMapper
@@ -25,7 +25,7 @@ type MetaCache struct {
func NewMetaCache(dbFolder string, uidGidMapper *UidGidMapper) *MetaCache {
return &MetaCache{
- actualStore: openMetaStore(dbFolder),
+ localStore: openMetaStore(dbFolder),
visitedBoundary: bounded_tree.NewBoundedTree(),
uidGidMapper: uidGidMapper,
}
@@ -57,7 +57,7 @@ func (mc *MetaCache) InsertEntry(ctx context.Context, entry *filer.Entry) error
func (mc *MetaCache) doInsertEntry(ctx context.Context, entry *filer.Entry) error {
filer_pb.BeforeEntrySerialization(entry.Chunks)
- return mc.actualStore.InsertEntry(ctx, entry)
+ return mc.localStore.InsertEntry(ctx, entry)
}
func (mc *MetaCache) AtomicUpdateEntryFromFiler(ctx context.Context, oldPath util.FullPath, newEntry *filer.Entry) error {
@@ -71,7 +71,7 @@ func (mc *MetaCache) AtomicUpdateEntryFromFiler(ctx context.Context, oldPath uti
// skip the unnecessary deletion
// leave the update to the following InsertEntry operation
} else {
- if err := mc.actualStore.DeleteEntry(ctx, oldPath); err != nil {
+ if err := mc.localStore.DeleteEntry(ctx, oldPath); err != nil {
return err
}
}
@@ -83,7 +83,7 @@ func (mc *MetaCache) AtomicUpdateEntryFromFiler(ctx context.Context, oldPath uti
if newEntry != nil {
newDir, _ := newEntry.DirAndName()
if mc.visitedBoundary.HasVisited(util.FullPath(newDir)) {
- if err := mc.actualStore.InsertEntry(ctx, newEntry); err != nil {
+ if err := mc.localStore.InsertEntry(ctx, newEntry); err != nil {
return err
}
}
@@ -95,13 +95,13 @@ func (mc *MetaCache) UpdateEntry(ctx context.Context, entry *filer.Entry) error
mc.Lock()
defer mc.Unlock()
filer_pb.BeforeEntrySerialization(entry.Chunks)
- return mc.actualStore.UpdateEntry(ctx, entry)
+ return mc.localStore.UpdateEntry(ctx, entry)
}
func (mc *MetaCache) FindEntry(ctx context.Context, fp util.FullPath) (entry *filer.Entry, err error) {
mc.RLock()
defer mc.RUnlock()
- entry, err = mc.actualStore.FindEntry(ctx, fp)
+ entry, err = mc.localStore.FindEntry(ctx, fp)
if err != nil {
return nil, err
}
@@ -113,14 +113,14 @@ func (mc *MetaCache) FindEntry(ctx context.Context, fp util.FullPath) (entry *fi
func (mc *MetaCache) DeleteEntry(ctx context.Context, fp util.FullPath) (err error) {
mc.Lock()
defer mc.Unlock()
- return mc.actualStore.DeleteEntry(ctx, fp)
+ return mc.localStore.DeleteEntry(ctx, fp)
}
func (mc *MetaCache) ListDirectoryEntries(ctx context.Context, dirPath util.FullPath, startFileName string, includeStartFile bool, limit int) ([]*filer.Entry, error) {
mc.RLock()
defer mc.RUnlock()
- entries, err := mc.actualStore.ListDirectoryEntries(ctx, dirPath, startFileName, includeStartFile, limit)
+ entries, err := mc.localStore.ListDirectoryEntries(ctx, dirPath, startFileName, includeStartFile, limit)
if err != nil {
return nil, err
}
@@ -134,7 +134,7 @@ func (mc *MetaCache) ListDirectoryEntries(ctx context.Context, dirPath util.Full
func (mc *MetaCache) Shutdown() {
mc.Lock()
defer mc.Unlock()
- mc.actualStore.Shutdown()
+ mc.localStore.Shutdown()
}
func (mc *MetaCache) mapIdFromFilerToLocal(entry *filer.Entry) {
diff --git a/weed/filesys/wfs.go b/weed/filesys/wfs.go
index 8d46e0862..0335d5d98 100644
--- a/weed/filesys/wfs.go
+++ b/weed/filesys/wfs.go
@@ -88,7 +88,7 @@ func NewSeaweedFileSystem(option *Option) *WFS {
cacheUniqueId := util.Md5String([]byte(option.FilerGrpcAddress + option.FilerMountRootPath + util.Version()))[0:4]
cacheDir := path.Join(option.CacheDir, cacheUniqueId)
if option.CacheSizeMB > 0 {
- os.MkdirAll(cacheDir, 0755)
+ os.MkdirAll(cacheDir, os.FileMode(0777) &^ option.Umask)
wfs.chunkCache = chunk_cache.NewTieredChunkCache(256, cacheDir, option.CacheSizeMB)
}
diff --git a/weed/topology/topology_vacuum.go b/weed/topology/topology_vacuum.go
index ecb5ebd0d..4f3d69627 100644
--- a/weed/topology/topology_vacuum.go
+++ b/weed/topology/topology_vacuum.go
@@ -165,7 +165,7 @@ func vacuumOneVolumeLayout(grpcDialOption grpc.DialOption, volumeLayout *VolumeL
volumeLayout.accessLock.RLock()
tmpMap := make(map[needle.VolumeId]*VolumeLocationList)
for vid, locationList := range volumeLayout.vid2location {
- tmpMap[vid] = locationList
+ tmpMap[vid] = locationList.Copy()
}
volumeLayout.accessLock.RUnlock()
diff --git a/weed/topology/volume_location_list.go b/weed/topology/volume_location_list.go
index 8905c54b5..6acd70f2f 100644
--- a/weed/topology/volume_location_list.go
+++ b/weed/topology/volume_location_list.go
@@ -18,6 +18,14 @@ func (dnll *VolumeLocationList) String() string {
return fmt.Sprintf("%v", dnll.list)
}
+func (dnll *VolumeLocationList) Copy() *VolumeLocationList {
+ list := make([]*DataNode, len(dnll.list))
+ copy(list, dnll.list)
+ return &VolumeLocationList{
+ list: list,
+ }
+}
+
func (dnll *VolumeLocationList) Head() *DataNode {
//mark first node as master volume
return dnll.list[0]