Browse Source

adjust logs

pull/1189/head
Chris Lu 5 years ago
parent
commit
e9bb0c179f
  1. 9
      weed/filesys/dir.go
  2. 7
      weed/filesys/xattr.go

9
weed/filesys/dir.go

@ -69,6 +69,8 @@ func (dir *Dir) Getxattr(ctx context.Context, req *fuse.GetxattrRequest, resp *f
} }
func (dir *Dir) setRootDirAttributes(attr *fuse.Attr) { func (dir *Dir) setRootDirAttributes(attr *fuse.Attr) {
attr.Inode = 1
attr.Valid = time.Hour
attr.Uid = dir.wfs.option.MountUid attr.Uid = dir.wfs.option.MountUid
attr.Gid = dir.wfs.option.MountGid attr.Gid = dir.wfs.option.MountGid
attr.Mode = dir.wfs.option.MountMode attr.Mode = dir.wfs.option.MountMode
@ -76,6 +78,7 @@ func (dir *Dir) setRootDirAttributes(attr *fuse.Attr) {
attr.Ctime = dir.wfs.option.MountCtime attr.Ctime = dir.wfs.option.MountCtime
attr.Mtime = dir.wfs.option.MountMtime attr.Mtime = dir.wfs.option.MountMtime
attr.Atime = 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 { 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.EntryValid = time.Duration(0)
resp.Attr.Valid = time.Duration(0)
resp.Attr.Mtime = time.Unix(entry.Attributes.Mtime, 0) resp.Attr.Mtime = time.Unix(entry.Attributes.Mtime, 0)
resp.Attr.Ctime = time.Unix(entry.Attributes.Crtime, 0) resp.Attr.Ctime = time.Unix(entry.Attributes.Crtime, 0)
resp.Attr.Mode = os.FileMode(entry.Attributes.FileMode) 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 return node, nil
} }
glog.V(1).Infof("not found dir GetEntry %s: %v", fullFilePath, err)
return nil, fuse.ENOENT 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) glog.V(3).Infof("remove file: %v", request)
_, err := client.DeleteEntry(ctx, request) _, err := client.DeleteEntry(ctx, request)
if err != nil { 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 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) glog.V(3).Infof("remove directory entry: %v", request)
_, err := client.DeleteEntry(ctx, request) _, err := client.DeleteEntry(ctx, request)
if err != nil { 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 return fuse.ENOENT
} }

7
weed/filesys/xattr.go

@ -4,6 +4,7 @@ import (
"context" "context"
"path/filepath" "path/filepath"
"github.com/chrislusf/seaweedfs/weed/filer2"
"github.com/chrislusf/seaweedfs/weed/glog" "github.com/chrislusf/seaweedfs/weed/glog"
"github.com/chrislusf/seaweedfs/weed/pb/filer_pb" "github.com/chrislusf/seaweedfs/weed/pb/filer_pb"
"github.com/seaweedfs/fuse" "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) entry = item.Value().(*filer_pb.Entry)
return 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 { 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) resp, err := client.LookupDirectoryEntry(ctx, request)
if err != nil || resp == nil || resp.Entry == nil { 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) glog.V(3).Infof("file attr read file %v: %v", request, err)
return fuse.ENOENT return fuse.ENOENT
} }

Loading…
Cancel
Save