Skip to content

Commit

Permalink
reset attr, especially acl
Browse files Browse the repository at this point in the history
Signed-off-by: jiefenghuang <[email protected]>
  • Loading branch information
jiefenghuang committed Dec 23, 2024
1 parent 4105d1e commit eba103f
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
21 changes: 21 additions & 0 deletions pkg/meta/base.go
Original file line number Diff line number Diff line change
Expand Up @@ -813,6 +813,27 @@ func (m *baseMeta) Lookup(ctx Context, parent Ino, name string, inode *Ino, attr
return st
}

func (attr *Attr) reset() {
attr.Flags = 0
attr.Mode = 0
attr.Typ = 0
attr.Uid = 0
attr.Gid = 0
attr.Atime = 0
attr.Atimensec = 0
attr.Mtime = 0
attr.Mtimensec = 0
attr.Ctime = 0
attr.Ctimensec = 0
attr.Nlink = 0
attr.Length = 0
attr.Rdev = 0
attr.Parent = 0
attr.AccessACL = aclAPI.None
attr.DefaultACL = aclAPI.None
attr.Full = false
}

func (m *baseMeta) parseAttr(buf []byte, attr *Attr) {
if attr == nil || len(buf) == 0 {
return
Expand Down
1 change: 1 addition & 0 deletions pkg/meta/sql_bak.go
Original file line number Diff line number Diff line change
Expand Up @@ -526,6 +526,7 @@ func (m *dbMeta) loadNodes(ctx Context, msg proto.Message) error {
for i, n := range nodes {
pn := &ns[i]
pn.Inode = Ino(n.Inode)
attr.reset()
b.parseAttr(n.Data, attr)
m.parseNode(attr, pn)
rows = append(rows, pn)
Expand Down

0 comments on commit eba103f

Please sign in to comment.