chore:reva bump v.2.33.1 (#1027)
This commit is contained in:
+22
-16
@@ -227,11 +227,11 @@ func (t *Tree) TouchFile(ctx context.Context, n *node.Node, markprocessing bool,
|
||||
}
|
||||
|
||||
if err := os.MkdirAll(filepath.Dir(nodePath), 0700); err != nil {
|
||||
return errors.Wrap(err, "Decomposedfs: error creating node")
|
||||
return errors.Wrap(err, "posixfs: error creating node")
|
||||
}
|
||||
f, err := os.Create(nodePath)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "Decomposedfs: error creating node")
|
||||
return errors.Wrap(err, "posixfs: error creating node")
|
||||
}
|
||||
|
||||
attributes := n.NodeMetadata(ctx)
|
||||
@@ -304,7 +304,7 @@ func (t *Tree) Move(ctx context.Context, oldNode *node.Node, newNode *node.Node)
|
||||
if newNode.Exists {
|
||||
// TODO make sure all children are deleted
|
||||
if err := os.RemoveAll(newNode.InternalPath()); err != nil {
|
||||
return errors.Wrap(err, "Decomposedfs: Move: error deleting target node "+newNode.ID)
|
||||
return errors.Wrap(err, "posixfs: Move: error deleting target node "+newNode.ID)
|
||||
}
|
||||
}
|
||||
oldParent := oldNode.ParentPath()
|
||||
@@ -313,14 +313,6 @@ func (t *Tree) Move(ctx context.Context, oldNode *node.Node, newNode *node.Node)
|
||||
newNode.ID = oldNode.ID
|
||||
}
|
||||
|
||||
// update target parentid and name
|
||||
attribs := node.Attributes{}
|
||||
attribs.SetString(prefixes.ParentidAttr, newNode.ParentID)
|
||||
attribs.SetString(prefixes.NameAttr, newNode.Name)
|
||||
if err := oldNode.SetXattrsWithContext(ctx, attribs, true); err != nil {
|
||||
return errors.Wrap(err, "Decomposedfs: could not update old node attributes")
|
||||
}
|
||||
|
||||
// update the id cache
|
||||
// invalidate old tree
|
||||
err = t.lookup.IDCache.DeleteByPath(ctx, filepath.Join(oldNode.ParentPath(), oldNode.Name))
|
||||
@@ -337,14 +329,28 @@ func (t *Tree) Move(ctx context.Context, oldNode *node.Node, newNode *node.Node)
|
||||
filepath.Join(newParent, newNode.Name),
|
||||
)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "Decomposedfs: could not move child")
|
||||
if err := t.lookup.CacheID(ctx, oldNode.SpaceID, oldNode.ID, filepath.Join(oldNode.ParentPath(), oldNode.Name)); err != nil {
|
||||
t.log.Error().Err(err).Str("spaceID", oldNode.SpaceID).Str("id", oldNode.ID).Str("path", filepath.Join(oldNode.ParentPath(), oldNode.Name)).Msg("could not reset cached id after failed move")
|
||||
}
|
||||
if err := t.WarmupIDCache(filepath.Join(oldNode.ParentPath(), oldNode.Name), false, false); err != nil {
|
||||
t.log.Error().Err(err).Str("spaceID", oldNode.SpaceID).Str("id", oldNode.ID).Str("path", filepath.Join(oldNode.ParentPath(), oldNode.Name)).Msg("could not warum cached after failed move")
|
||||
}
|
||||
return errors.Wrap(err, "posixfs: could not move child")
|
||||
}
|
||||
|
||||
// update target parentid and name
|
||||
attribs := node.Attributes{}
|
||||
attribs.SetString(prefixes.ParentidAttr, newNode.ParentID)
|
||||
attribs.SetString(prefixes.NameAttr, newNode.Name)
|
||||
if err := newNode.SetXattrsWithContext(ctx, attribs, true); err != nil {
|
||||
return errors.Wrap(err, "posixfs: could not update node attributes")
|
||||
}
|
||||
|
||||
// rename the lock (if it exists)
|
||||
if _, err := os.Stat(lockFilePath); err == nil {
|
||||
err = os.Rename(lockFilePath, newNode.LockFilePath())
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "Decomposedfs: could not move lock")
|
||||
return errors.Wrap(err, "posixfs: could not move lock")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -370,11 +376,11 @@ func (t *Tree) Move(ctx context.Context, oldNode *node.Node, newNode *node.Node)
|
||||
|
||||
err = t.Propagate(ctx, oldNode, -sizeDiff)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "Decomposedfs: Move: could not propagate old node")
|
||||
return errors.Wrap(err, "posixfs: Move: could not propagate old node")
|
||||
}
|
||||
err = t.Propagate(ctx, newNode, sizeDiff)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "Decomposedfs: Move: could not propagate new node")
|
||||
return errors.Wrap(err, "posixfs: Move: could not propagate new node")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -643,7 +649,7 @@ func (t *Tree) createDirNode(ctx context.Context, n *node.Node) (err error) {
|
||||
}()
|
||||
|
||||
if err := os.MkdirAll(path, 0700); err != nil {
|
||||
return errors.Wrap(err, "Decomposedfs: error creating node")
|
||||
return errors.Wrap(err, "posixfs: error creating node")
|
||||
}
|
||||
|
||||
if err := idcache.Set(ctx, n.SpaceID, n.ID, path); err != nil {
|
||||
|
||||
+13
-6
@@ -4,8 +4,8 @@
|
||||
package xattr
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"os"
|
||||
"syscall"
|
||||
|
||||
"golang.org/x/sys/unix"
|
||||
)
|
||||
@@ -17,10 +17,11 @@ const (
|
||||
XATTR_CREATE = 0x1
|
||||
XATTR_REPLACE = 0x2
|
||||
|
||||
// ENOATTR is not exported by the syscall package on Linux, because it is
|
||||
// an alias for ENODATA. We export it here so it is available on all
|
||||
// our supported platforms.
|
||||
ENOATTR = syscall.ENODATA
|
||||
// ENOATTR is not defined on Solaris. When attempting to open an
|
||||
// extended attribute that doesn't exist, we'll get ENOENT. For
|
||||
// compatibility with other platforms, we make ENOATTR available as
|
||||
// an alias of unix.ENOENT.
|
||||
ENOATTR = unix.ENOENT
|
||||
)
|
||||
|
||||
func getxattr(path string, name string, data []byte) (int, error) {
|
||||
@@ -132,7 +133,13 @@ func llistxattr(path string, data []byte) (int, error) {
|
||||
func flistxattr(f *os.File, data []byte) (int, error) {
|
||||
fd, err := unix.Openat(int(f.Fd()), ".", unix.O_RDONLY|unix.O_XATTR, 0)
|
||||
if err != nil {
|
||||
return 0, unix.ENOTSUP
|
||||
// When attempting to list extended attributes on a filesystem
|
||||
// that doesn't support them (like as UFS and tmpfs), we'll get
|
||||
// EINVAL. Translate this error to the more conventional ENOTSUP.
|
||||
if errors.Is(err, unix.EINVAL) {
|
||||
return 0, unix.ENOTSUP
|
||||
}
|
||||
return 0, err
|
||||
}
|
||||
xf := os.NewFile(uintptr(fd), f.Name())
|
||||
defer func() {
|
||||
|
||||
Reference in New Issue
Block a user