fuse mount: avoid lookup nil entry

fix https://github.com/chrislusf/seaweedfs/issues/1221
This commit is contained in:
Chris Lu
2020-03-07 16:51:46 -08:00
parent 936e7cdbfb
commit 8645283a7b
10 changed files with 47 additions and 35 deletions

View File

@@ -1,9 +1,6 @@
package filesys
import (
"context"
"strings"
"github.com/chrislusf/seaweedfs/weed/filer2"
"github.com/chrislusf/seaweedfs/weed/glog"
"github.com/chrislusf/seaweedfs/weed/pb/filer_pb"
@@ -124,9 +121,9 @@ func (wfs *WFS) maybeLoadEntry(dir, name string) (entry *filer_pb.Entry, err err
Directory: dir,
}
resp, err := client.LookupDirectoryEntry(context.Background(), request)
if err != nil || resp == nil || resp.Entry == nil {
if err == filer2.ErrNotFound || strings.Contains(err.Error(), filer2.ErrNotFound.Error()) {
resp, err := filer_pb.LookupEntry(client, request)
if err != nil {
if err == filer2.ErrNotFound {
glog.V(3).Infof("file attr read not found file %v: %v", request, err)
return fuse.ENOENT
}