From 02da0465063bb33544131134681b88f93077c0a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Friedrich=20Dreyer?= Date: Tue, 15 Feb 2022 08:22:41 +0000 Subject: [PATCH] small fixes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jörn Friedrich Dreyer --- changelog/unreleased/decomposedfs-xattr-errors.md | 1 + pkg/storage/utils/decomposedfs/node/node.go | 7 +------ pkg/storage/utils/decomposedfs/spaces.go | 6 ++---- 3 files changed, 4 insertions(+), 10 deletions(-) diff --git a/changelog/unreleased/decomposedfs-xattr-errors.md b/changelog/unreleased/decomposedfs-xattr-errors.md index 3b21b1baf80..3d24b18bc6d 100644 --- a/changelog/unreleased/decomposedfs-xattr-errors.md +++ b/changelog/unreleased/decomposedfs-xattr-errors.md @@ -3,3 +3,4 @@ Enhancement: Refactored the xattrs package in the decomposedfs The xattrs package now uses the xattr.ENOATTR instead of os.ENODATA or os.ENOATTR to check attribute existence. https://github.com/cs3org/reva/pull/2540 +https://github.com/cs3org/reva/pull/2541 diff --git a/pkg/storage/utils/decomposedfs/node/node.go b/pkg/storage/utils/decomposedfs/node/node.go index c2156084a02..0e21552bd1e 100644 --- a/pkg/storage/utils/decomposedfs/node/node.go +++ b/pkg/storage/utils/decomposedfs/node/node.go @@ -265,7 +265,7 @@ func (n *Node) Child(ctx context.Context, name string) (*Node, error) { var c *Node if strings.HasPrefix(link, "../") { - c, err = ReadNode(ctx, n.lu, filepath.Base(link)) + c, err = ReadNode(ctx, n.lu, spaceID, filepath.Base(link)) if err != nil { return nil, errors.Wrap(err, "could not read child node") } @@ -411,11 +411,6 @@ func (n *Node) LockFilePath() string { return n.InternalPath() + ".lock" } -// LockFilePath returns the internal path of the lock file of the node -func (n *Node) LockFilePath() string { - return n.lu.InternalPath(n.ID) + ".lock" -} - // CalculateEtag returns a hash of fileid + tmtime (or mtime) func CalculateEtag(nodeID string, tmTime time.Time) (string, error) { return calculateEtag(nodeID, tmTime) diff --git a/pkg/storage/utils/decomposedfs/spaces.go b/pkg/storage/utils/decomposedfs/spaces.go index 2cfa7d6927b..2fe33ef5260 100644 --- a/pkg/storage/utils/decomposedfs/spaces.go +++ b/pkg/storage/utils/decomposedfs/spaces.go @@ -515,11 +515,9 @@ func (fs *Decomposedfs) DeleteStorageSpace(ctx context.Context, req *provider.De if len(matches) != 1 { return fmt.Errorf("delete root node failed: found %d matching root nodes", len(matches)) } - - n, err := node.ReadNode(ctx, fs.lu, spaceID, filepath.Base(target)) - if err != nil { return os.RemoveAll(matches[0]) } + // don't delete - just rename dn := *n deletionTime := time.Now().UTC().Format(time.RFC3339Nano) @@ -540,7 +538,7 @@ func (fs *Decomposedfs) DeleteStorageSpace(ctx context.Context, req *provider.De return os.Symlink(trashPath, np) } -func (fs *Decomposedfs) createStorageSpace(ctx context.Context, spaceType, spaceID string) error { +func (fs *Decomposedfs) createStorageSpace(ctx context.Context, spaceType string, spaceID string) error { // create space type dir if err := os.MkdirAll(filepath.Join(fs.o.Root, "spaces", spaceType), 0700); err != nil { return err