adjust logs

This commit is contained in:
Chris Lu 2020-01-18 13:25:17 -08:00
parent 061a61e018
commit e9bb0c179f
2 changed files with 13 additions and 3 deletions

View file

@ -69,6 +69,8 @@ func (dir *Dir) Getxattr(ctx context.Context, req *fuse.GetxattrRequest, resp *f
}
func (dir *Dir) setRootDirAttributes(attr *fuse.Attr) {
attr.Inode = 1
attr.Valid = time.Hour
attr.Uid = dir.wfs.option.MountUid
attr.Gid = dir.wfs.option.MountGid
attr.Mode = dir.wfs.option.MountMode
@ -76,6 +78,7 @@ func (dir *Dir) setRootDirAttributes(attr *fuse.Attr) {
attr.Ctime = dir.wfs.option.MountCtime
attr.Mtime = dir.wfs.option.MountMtime
attr.Atime = dir.wfs.option.MountMtime
attr.BlockSize = 1024 * 1024
}
func (dir *Dir) newFile(name string, entry *filer_pb.Entry) *File {
@ -202,6 +205,7 @@ func (dir *Dir) Lookup(ctx context.Context, req *fuse.LookupRequest, resp *fuse.
}
resp.EntryValid = time.Duration(0)
resp.Attr.Valid = time.Duration(0)
resp.Attr.Mtime = time.Unix(entry.Attributes.Mtime, 0)
resp.Attr.Ctime = time.Unix(entry.Attributes.Crtime, 0)
resp.Attr.Mode = os.FileMode(entry.Attributes.FileMode)
@ -211,6 +215,7 @@ func (dir *Dir) Lookup(ctx context.Context, req *fuse.LookupRequest, resp *fuse.
return node, nil
}
glog.V(1).Infof("not found dir GetEntry %s: %v", fullFilePath, err)
return nil, fuse.ENOENT
}
@ -270,7 +275,7 @@ func (dir *Dir) removeOneFile(ctx context.Context, req *fuse.RemoveRequest) erro
glog.V(3).Infof("remove file: %v", request)
_, err := client.DeleteEntry(ctx, request)
if err != nil {
glog.V(3).Infof("remove file %s/%s: %v", dir.Path, req.Name, err)
glog.V(3).Infof("not found remove file %s/%s: %v", dir.Path, req.Name, err)
return fuse.ENOENT
}
@ -294,7 +299,7 @@ func (dir *Dir) removeFolder(ctx context.Context, req *fuse.RemoveRequest) error
glog.V(3).Infof("remove directory entry: %v", request)
_, err := client.DeleteEntry(ctx, request)
if err != nil {
glog.V(3).Infof("remove %s/%s: %v", dir.Path, req.Name, err)
glog.V(3).Infof("not found remove %s/%s: %v", dir.Path, req.Name, err)
return fuse.ENOENT
}

View file

@ -4,6 +4,7 @@ import (
"context"
"path/filepath"
"github.com/chrislusf/seaweedfs/weed/filer2"
"github.com/chrislusf/seaweedfs/weed/glog"
"github.com/chrislusf/seaweedfs/weed/pb/filer_pb"
"github.com/seaweedfs/fuse"
@ -115,7 +116,7 @@ func (wfs *WFS) maybeLoadEntry(ctx context.Context, dir, name string) (entry *fi
entry = item.Value().(*filer_pb.Entry)
return
}
glog.V(3).Infof("read entry cache miss %s", fullpath)
// glog.V(3).Infof("read entry cache miss %s", fullpath)
err = wfs.WithFilerClient(ctx, func(client filer_pb.SeaweedFilerClient) error {
@ -126,6 +127,10 @@ func (wfs *WFS) maybeLoadEntry(ctx context.Context, dir, name string) (entry *fi
resp, err := client.LookupDirectoryEntry(ctx, request)
if err != nil || resp == nil || resp.Entry == nil {
if err == filer2.ErrNotFound {
glog.V(3).Infof("file attr read not found file %v: %v", request, err)
return fuse.ENOENT
}
glog.V(3).Infof("file attr read file %v: %v", request, err)
return fuse.ENOENT
}