Skip to content

Commit

Permalink
drop O_CREATE for messagepack backend
Browse files Browse the repository at this point in the history
Signed-off-by: Jörn Friedrich Dreyer <[email protected]>
  • Loading branch information
butonic committed Jul 4, 2023
1 parent 4d867d5 commit 5865184
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 3 additions & 0 deletions changelog/unreleased/no-o-create-for-messagepack.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Bugfix: messagepack backend no longer tries propagates metadata to a non existing parent

https://github.com/cs3org/reva/pull/3980
4 changes: 3 additions & 1 deletion pkg/storage/utils/decomposedfs/tree/tree.go
Original file line number Diff line number Diff line change
Expand Up @@ -754,10 +754,12 @@ func (t *Tree) Propagate(ctx context.Context, n *node.Node, sizeDiff int64) (err
switch t.lookup.MetadataBackend().(type) {
case metadata.MessagePackBackend:
parentFilename = t.lookup.MetadataBackend().MetadataPath(n.ParentPath())
f, err = lockedfile.OpenFile(parentFilename, os.O_RDWR|os.O_CREATE, 0600)
// no need to O_CREATE the file, we can use the metadata file. Actually, we want to error if the parent does not exist!
f, err = lockedfile.OpenFile(parentFilename, os.O_RDWR, 0600)
case metadata.XattrsBackend:
// we have to use dedicated lockfiles to lock directories
// this only works because the xattr backend also locks folders with separate lock files
// we need to O_CREATE a lockfile if it does not exist, yet
parentFilename = n.ParentPath() + filelocks.LockFileSuffix
f, err = lockedfile.OpenFile(parentFilename, os.O_RDWR|os.O_CREATE, 0600)
}
Expand Down

0 comments on commit 5865184

Please sign in to comment.