mount: in case the set attribute is called before persisting the file

This commit is contained in:
Chris Lu 2021-05-09 22:55:30 -07:00
parent 74052064b6
commit 280e7cf289

View file

@ -336,20 +336,20 @@ func (file *File) saveEntry(entry *filer_pb.Entry) error {
file.wfs.mapPbIdFromLocalToFiler(entry) file.wfs.mapPbIdFromLocalToFiler(entry)
defer file.wfs.mapPbIdFromFilerToLocal(entry) defer file.wfs.mapPbIdFromFilerToLocal(entry)
request := &filer_pb.UpdateEntryRequest{ request := &filer_pb.CreateEntryRequest{
Directory: file.dir.FullPath(), Directory: file.dir.FullPath(),
Entry: entry, Entry: entry,
Signatures: []int32{file.wfs.signature}, Signatures: []int32{file.wfs.signature},
} }
glog.V(4).Infof("save file entry: %v", request) glog.V(4).Infof("save file entry: %v", request)
_, err := client.UpdateEntry(context.Background(), request) _, err := client.CreateEntry(context.Background(), request)
if err != nil { if err != nil {
glog.Errorf("UpdateEntry file %s/%s: %v", file.dir.FullPath(), file.Name, err) glog.Errorf("UpdateEntry file %s/%s: %v", file.dir.FullPath(), file.Name, err)
return fuse.EIO return fuse.EIO
} }
file.wfs.metaCache.UpdateEntry(context.Background(), filer.FromPbEntry(request.Directory, request.Entry)) file.wfs.metaCache.InsertEntry(context.Background(), filer.FromPbEntry(request.Directory, request.Entry))
return nil return nil
}) })