Skip to content

Commit d8ba908

Browse files
committed
fix(decomposedfs): remove orphaned node file when symlink fails in TouchFile
1 parent 676d68a commit d8ba908

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

  • pkg/storage/utils/decomposedfs/tree

‎pkg/storage/utils/decomposedfs/tree/tree.go‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ func (t *Tree) TouchFile(ctx context.Context, n *node.Node, markprocessing bool,
173173
childNameLink := filepath.Join(n.ParentPath(), n.Name)
174174
relativeNodePath := filepath.Join("../../../../../", lookup.Pathify(n.ID, 4, 2))
175175
if err = os.Symlink(relativeNodePath, childNameLink); err != nil {
176+
_ = os.Remove(nodePath)
176177
if errors.Is(err, fs.ErrExist) {
177178
return errtypes.AlreadyExists(n.Name)
178179
}

0 commit comments

Comments
 (0)