Skip to content

Commit

Permalink
use more robust space root check
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 Nov 8, 2024
1 parent b35d043 commit 34912e2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 14 deletions.
14 changes: 7 additions & 7 deletions pkg/storage/utils/decomposedfs/node/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ import (
userpb "github.com/cs3org/go-cs3apis/cs3/identity/user/v1beta1"
provider "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1"
types "github.com/cs3org/go-cs3apis/cs3/types/v1beta1"
"github.com/google/uuid"
"github.com/pkg/errors"
"github.com/rogpeppe/go-internal/lockedfile"
"go.opentelemetry.io/otel"
"go.opentelemetry.io/otel/trace"

"github.com/cs3org/reva/v2/internal/grpc/services/storageprovider"
"github.com/cs3org/reva/v2/pkg/appctx"
ctxpkg "github.com/cs3org/reva/v2/pkg/ctx"
Expand All @@ -48,11 +54,6 @@ import (
"github.com/cs3org/reva/v2/pkg/storage/utils/decomposedfs/metadata/prefixes"
"github.com/cs3org/reva/v2/pkg/storage/utils/grants"
"github.com/cs3org/reva/v2/pkg/utils"
"github.com/google/uuid"
"github.com/pkg/errors"
"github.com/rogpeppe/go-internal/lockedfile"
"go.opentelemetry.io/otel"
"go.opentelemetry.io/otel/trace"
)

var tracer trace.Tracer
Expand Down Expand Up @@ -1261,8 +1262,7 @@ func (n *Node) ProcessingID(ctx context.Context) (string, error) {

// IsSpaceRoot checks if the node is a space root
func (n *Node) IsSpaceRoot(ctx context.Context) bool {
_, err := n.Xattr(ctx, prefixes.SpaceNameAttr)
return err == nil
return n.ID == n.SpaceID
}

// SetScanData sets the virus scan info to the node
Expand Down
15 changes: 8 additions & 7 deletions pkg/storage/utils/decomposedfs/tree/propagator/async.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,20 @@ import (
"strings"
"time"

"github.com/google/renameio/v2"
"github.com/google/uuid"
"github.com/pkg/errors"
"github.com/rogpeppe/go-internal/lockedfile"
"github.com/rs/zerolog"
"github.com/shamaton/msgpack/v2"

"github.com/cs3org/reva/v2/pkg/appctx"
"github.com/cs3org/reva/v2/pkg/logger"
"github.com/cs3org/reva/v2/pkg/storage/utils/decomposedfs/lookup"
"github.com/cs3org/reva/v2/pkg/storage/utils/decomposedfs/metadata"
"github.com/cs3org/reva/v2/pkg/storage/utils/decomposedfs/metadata/prefixes"
"github.com/cs3org/reva/v2/pkg/storage/utils/decomposedfs/node"
"github.com/cs3org/reva/v2/pkg/storage/utils/decomposedfs/options"
"github.com/google/renameio/v2"
"github.com/google/uuid"
"github.com/pkg/errors"
"github.com/rogpeppe/go-internal/lockedfile"
"github.com/rs/zerolog"
"github.com/shamaton/msgpack/v2"
)

var _propagationGracePeriod = 3 * time.Minute
Expand Down Expand Up @@ -414,7 +415,7 @@ func (p AsyncPropagator) propagate(ctx context.Context, spaceID, nodeID string,
log.Info().Msg("Propagation done. cleaning up")
cleanup()

if !n.IsSpaceRoot(ctx) { // This does not seem robust as it checks the space name property
if !n.IsSpaceRoot(ctx) {
p.queuePropagation(ctx, n.SpaceID, n.ParentID, pc, log)
}

Expand Down

0 comments on commit 34912e2

Please sign in to comment.