mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
mount: reuse the entry object for the new directory
avoid mkdir and then query for the same directory reduces these "context canceled" issues attr read directory:"/seaweedfs/other/java/s3copier/src/main/java/com" name:"seaweedfs" : rpc error: code = Canceled desc = context canceled
This commit is contained in:
parent
90e30c0170
commit
8cccccce9f
|
@ -154,11 +154,7 @@ func (dir *Dir) Create(ctx context.Context, req *fuse.CreateRequest,
|
||||||
|
|
||||||
func (dir *Dir) Mkdir(ctx context.Context, req *fuse.MkdirRequest) (fs.Node, error) {
|
func (dir *Dir) Mkdir(ctx context.Context, req *fuse.MkdirRequest) (fs.Node, error) {
|
||||||
|
|
||||||
err := dir.wfs.WithFilerClient(ctx, func(client filer_pb.SeaweedFilerClient) error {
|
newEntry := &filer_pb.Entry{
|
||||||
|
|
||||||
request := &filer_pb.CreateEntryRequest{
|
|
||||||
Directory: dir.Path,
|
|
||||||
Entry: &filer_pb.Entry{
|
|
||||||
Name: req.Name,
|
Name: req.Name,
|
||||||
IsDirectory: true,
|
IsDirectory: true,
|
||||||
Attributes: &filer_pb.FuseAttributes{
|
Attributes: &filer_pb.FuseAttributes{
|
||||||
|
@ -168,7 +164,13 @@ func (dir *Dir) Mkdir(ctx context.Context, req *fuse.MkdirRequest) (fs.Node, err
|
||||||
Uid: req.Uid,
|
Uid: req.Uid,
|
||||||
Gid: req.Gid,
|
Gid: req.Gid,
|
||||||
},
|
},
|
||||||
},
|
}
|
||||||
|
|
||||||
|
err := dir.wfs.WithFilerClient(ctx, func(client filer_pb.SeaweedFilerClient) error {
|
||||||
|
|
||||||
|
request := &filer_pb.CreateEntryRequest{
|
||||||
|
Directory: dir.Path,
|
||||||
|
Entry: newEntry,
|
||||||
}
|
}
|
||||||
|
|
||||||
glog.V(1).Infof("mkdir: %v", request)
|
glog.V(1).Infof("mkdir: %v", request)
|
||||||
|
@ -181,7 +183,7 @@ func (dir *Dir) Mkdir(ctx context.Context, req *fuse.MkdirRequest) (fs.Node, err
|
||||||
})
|
})
|
||||||
|
|
||||||
if err == nil {
|
if err == nil {
|
||||||
node := dir.newDirectory(filer2.NewFullPath(dir.Path, req.Name), nil)
|
node := dir.newDirectory(filer2.NewFullPath(dir.Path, req.Name), newEntry)
|
||||||
return node, nil
|
return node, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue