Skip to content

Commit

Permalink
fix(meta): create dentry concurrency cause orphan inodes
Browse files Browse the repository at this point in the history
Signed-off-by: sunjiapeng <782615313@qq.com>
  • Loading branch information
sjp00556 committed Mar 11, 2024
1 parent 491c1cb commit 86696fc
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions sdk/meta/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -324,10 +324,8 @@ create_dentry:
}
return nil, statusToErrno(status)
} else if status != statusOK {
if status != statusExist {
mw.iunlink(mp, info.Inode, mw.Client.GetLatestVer(), 0, fullPath)
mw.ievict(mp, info.Inode, fullPath)
}
mw.iunlink(mp, info.Inode, mw.Client.GetLatestVer(), 0, fullPath)
mw.ievict(mp, info.Inode, fullPath)

Check warning on line 328 in sdk/meta/api.go

View check run for this annotation

Codecov / codecov/patch

sdk/meta/api.go#L327-L328

Added lines #L327 - L328 were not covered by tests
return nil, statusToErrno(status)
}
if mw.EnableSummary {
Expand Down Expand Up @@ -1657,9 +1655,7 @@ func (mw *MetaWrapper) link(parentID uint64, name string, ino uint64, fullPath s
if err != nil {
return nil, statusToErrno(status)
} else if status != statusOK {
if status != statusExist {
mw.iunlink(mp, ino, mw.Client.GetLatestVer(), 0, fullPath)
}
mw.iunlink(mp, ino, mw.Client.GetLatestVer(), 0, fullPath)

Check warning on line 1658 in sdk/meta/api.go

View check run for this annotation

Codecov / codecov/patch

sdk/meta/api.go#L1658

Added line #L1658 was not covered by tests
return nil, statusToErrno(status)
}
return info, nil
Expand Down

0 comments on commit 86696fc

Please sign in to comment.