Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c7f9cac8ce | ||
|
|
01b441f639 |
No files matched your search
@@ -65,7 +65,7 @@ require (
|
|||||||
github.com/open-policy-agent/opa v1.19.0
|
github.com/open-policy-agent/opa v1.19.0
|
||||||
github.com/orcaman/concurrent-map v1.0.0
|
github.com/orcaman/concurrent-map v1.0.0
|
||||||
github.com/owncloud/libre-graph-api-go v1.0.5-0.20260216101009-eeac018af245
|
github.com/owncloud/libre-graph-api-go v1.0.5-0.20260216101009-eeac018af245
|
||||||
github.com/owncloud/reva/v2 v2.0.0-20260910093159-40663c5bb3cb
|
github.com/owncloud/reva/v2 v2.0.0-20261001074810-94c6e48f5c45
|
||||||
github.com/pkg/errors v0.9.1
|
github.com/pkg/errors v0.9.1
|
||||||
github.com/pkg/xattr v0.4.12
|
github.com/pkg/xattr v0.4.12
|
||||||
github.com/prometheus/client_golang v1.24.1
|
github.com/prometheus/client_golang v1.24.1
|
||||||
@@ -104,7 +104,7 @@ require (
|
|||||||
golang.org/x/term v0.45.0
|
golang.org/x/term v0.45.0
|
||||||
golang.org/x/text v0.41.0
|
golang.org/x/text v0.41.0
|
||||||
google.golang.org/genproto/googleapis/api v0.0.0-20260803160001-6ac0973c030d
|
google.golang.org/genproto/googleapis/api v0.0.0-20260803160001-6ac0973c030d
|
||||||
google.golang.org/grpc v1.83.1
|
google.golang.org/grpc v1.83.2
|
||||||
google.golang.org/protobuf v1.36.12
|
google.golang.org/protobuf v1.36.12
|
||||||
gopkg.in/yaml.v2 v2.4.0
|
gopkg.in/yaml.v2 v2.4.0
|
||||||
gotest.tools/v3 v3.5.2
|
gotest.tools/v3 v3.5.2
|
||||||
|
|||||||
@@ -735,8 +735,8 @@ github.com/orcaman/concurrent-map v1.0.0 h1:I/2A2XPCb4IuQWcQhBhSwGfiuybl/J0ev9HD
|
|||||||
github.com/orcaman/concurrent-map v1.0.0/go.mod h1:Lu3tH6HLW3feq74c2GC+jIMS/K2CFcDWnWD9XkenwhI=
|
github.com/orcaman/concurrent-map v1.0.0/go.mod h1:Lu3tH6HLW3feq74c2GC+jIMS/K2CFcDWnWD9XkenwhI=
|
||||||
github.com/owncloud/libre-graph-api-go v1.0.5-0.20260216101009-eeac018af245 h1:JRidLTAKhnvyLMRtVtSF4lhBa0NSAOs6fof+d6JnKII=
|
github.com/owncloud/libre-graph-api-go v1.0.5-0.20260216101009-eeac018af245 h1:JRidLTAKhnvyLMRtVtSF4lhBa0NSAOs6fof+d6JnKII=
|
||||||
github.com/owncloud/libre-graph-api-go v1.0.5-0.20260216101009-eeac018af245/go.mod h1:z61VMGAJRtR1nbgXWiNoCkxUXP1B3Je9rMuJbnGd+Og=
|
github.com/owncloud/libre-graph-api-go v1.0.5-0.20260216101009-eeac018af245/go.mod h1:z61VMGAJRtR1nbgXWiNoCkxUXP1B3Je9rMuJbnGd+Og=
|
||||||
github.com/owncloud/reva/v2 v2.0.0-20260910093159-40663c5bb3cb h1:pbFDeaDFhJ5dJF/ZYOyRf/FtD6MbG5BIPlOUeoh1vIs=
|
github.com/owncloud/reva/v2 v2.0.0-20261001074810-94c6e48f5c45 h1://i0KWRVB8U7vN3mrc+z1c3U/j0vpw/tcrdD5RuKJvQ=
|
||||||
github.com/owncloud/reva/v2 v2.0.0-20260910093159-40663c5bb3cb/go.mod h1:LSXqMWTC7Ya6uxmqp1ksrWYZXBuZ6PhcmVimxyG8U5o=
|
github.com/owncloud/reva/v2 v2.0.0-20261001074810-94c6e48f5c45/go.mod h1:LSXqMWTC7Ya6uxmqp1ksrWYZXBuZ6PhcmVimxyG8U5o=
|
||||||
github.com/oxtoacart/bpool v0.0.0-20190530202638-03653db5a59c h1:rp5dCmg/yLR3mgFuSOe4oEnDDmGLROTvMragMUXpTQw=
|
github.com/oxtoacart/bpool v0.0.0-20190530202638-03653db5a59c h1:rp5dCmg/yLR3mgFuSOe4oEnDDmGLROTvMragMUXpTQw=
|
||||||
github.com/oxtoacart/bpool v0.0.0-20190530202638-03653db5a59c/go.mod h1:X07ZCGwUbLaax7L0S3Tw4hpejzu63ZrrQiUe6W0hcy0=
|
github.com/oxtoacart/bpool v0.0.0-20190530202638-03653db5a59c/go.mod h1:X07ZCGwUbLaax7L0S3Tw4hpejzu63ZrrQiUe6W0hcy0=
|
||||||
github.com/pablodz/inotifywaitgo v0.0.12 h1:DVJJTFMDlSAdO46yisPF2vzozs/r+4k6ih8MVghq78M=
|
github.com/pablodz/inotifywaitgo v0.0.12 h1:DVJJTFMDlSAdO46yisPF2vzozs/r+4k6ih8MVghq78M=
|
||||||
@@ -1342,8 +1342,8 @@ google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3Iji
|
|||||||
google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak=
|
google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak=
|
||||||
google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak=
|
google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak=
|
||||||
google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc=
|
google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc=
|
||||||
google.golang.org/grpc v1.83.1 h1:HIO0+BEtBP6soyqvqC8sNUjZ7bTs+0hFQuFF+RAy++Y=
|
google.golang.org/grpc v1.83.2 h1:EManeRomTObA0BU7I8vXgg/78uE5MJ9M8B39EX2WscU=
|
||||||
google.golang.org/grpc v1.83.1/go.mod h1:kDyl6SKsiHKt0uylY5gtn5cEjkrIOhQOGDgIc4JGwzQ=
|
google.golang.org/grpc v1.83.2/go.mod h1:YPI1hK3kDked6iHvgX3tR0y+nX/qpMFKhPgFsokw1S8=
|
||||||
google.golang.org/grpc/examples v0.0.0-20211102180624-670c133e568e h1:m7aQHHqd0q89mRwhwS9Bx2rjyl/hsFAeta+uGrHsQaU=
|
google.golang.org/grpc/examples v0.0.0-20211102180624-670c133e568e h1:m7aQHHqd0q89mRwhwS9Bx2rjyl/hsFAeta+uGrHsQaU=
|
||||||
google.golang.org/grpc/examples v0.0.0-20211102180624-670c133e568e/go.mod h1:gID3PKrg7pWKntu9Ss6zTLJ0ttC0X9IHgREOCZwbCVU=
|
google.golang.org/grpc/examples v0.0.0-20211102180624-670c133e568e/go.mod h1:gID3PKrg7pWKntu9Ss6zTLJ0ttC0X9IHgREOCZwbCVU=
|
||||||
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
|
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
|
||||||
|
|||||||
Generated
Vendored
+4
-2
@@ -440,8 +440,10 @@ func (s *Service) InitiateFileUpload(ctx context.Context, req *provider.Initiate
|
|||||||
st = status.NewFailedPrecondition(ctx, err, "failed precondition")
|
st = status.NewFailedPrecondition(ctx, err, "failed precondition")
|
||||||
case errtypes.Locked:
|
case errtypes.Locked:
|
||||||
st = status.NewLocked(ctx, "locked")
|
st = status.NewLocked(ctx, "locked")
|
||||||
case errtypes.IsTooEarly:
|
case errtypes.Aborted:
|
||||||
st = status.NewAborted(ctx, err, "upload in progress, retry later")
|
st = status.NewAborted(ctx, err, "response from InitiateUpload")
|
||||||
|
case errtypes.AlreadyExists:
|
||||||
|
st = status.NewAlreadyExists(ctx, err, "response from InitiateUpload")
|
||||||
default:
|
default:
|
||||||
st = status.NewInternal(ctx, "error getting upload id: "+err.Error())
|
st = status.NewInternal(ctx, "error getting upload id: "+err.Error())
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-1
@@ -24,6 +24,7 @@ package errtypes
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
rpc "github.com/cs3org/go-cs3apis/cs3/rpc/v1beta1"
|
rpc "github.com/cs3org/go-cs3apis/cs3/rpc/v1beta1"
|
||||||
@@ -384,7 +385,7 @@ func NewErrtypeFromHTTPStatusCode(code int, message string) error {
|
|||||||
case StatusChecksumMismatch:
|
case StatusChecksumMismatch:
|
||||||
return ChecksumMismatch(message)
|
return ChecksumMismatch(message)
|
||||||
default:
|
default:
|
||||||
return InternalError(message)
|
return InternalError("http " + strconv.Itoa(code) + ": " + message)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+8
@@ -523,6 +523,14 @@ func (m *manager) ListPublicShares(ctx context.Context, u *user.User, filters []
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if local.ResourceId == nil {
|
||||||
|
log.Warn().
|
||||||
|
Str("share_id", local.PublicShare.GetId().GetOpaqueId()).
|
||||||
|
Str("share_token", local.Token).
|
||||||
|
Msg("ListPublicShares: skipping share with nil resource_id")
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
key := strings.Join([]string{local.ResourceId.StorageId, local.ResourceId.OpaqueId}, "!")
|
key := strings.Join([]string{local.ResourceId.StorageId, local.ResourceId.OpaqueId}, "!")
|
||||||
if _, hit := cache[key]; !hit && !publicshare.IsCreatedByUser(&local.PublicShare, u) {
|
if _, hit := cache[key]; !hit && !publicshare.IsCreatedByUser(&local.PublicShare, u) {
|
||||||
sRes, err := client.Stat(ctx, &provider.StatRequest{Ref: &provider.Reference{ResourceId: local.ResourceId}})
|
sRes, err := client.Stat(ctx, &provider.StatRequest{Ref: &provider.Reference{ResourceId: local.ResourceId}})
|
||||||
|
|||||||
Generated
Vendored
+128
-55
@@ -22,13 +22,13 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"math/rand/v2"
|
|
||||||
"os"
|
"os"
|
||||||
"path"
|
"path"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
backoff "github.com/cenkalti/backoff/v5"
|
||||||
collaboration "github.com/cs3org/go-cs3apis/cs3/sharing/collaboration/v1beta1"
|
collaboration "github.com/cs3org/go-cs3apis/cs3/sharing/collaboration/v1beta1"
|
||||||
provider "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1"
|
provider "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1"
|
||||||
"github.com/owncloud/reva/v2/pkg/appctx"
|
"github.com/owncloud/reva/v2/pkg/appctx"
|
||||||
@@ -37,6 +37,8 @@ import (
|
|||||||
"github.com/owncloud/reva/v2/pkg/storage/utils/metadata"
|
"github.com/owncloud/reva/v2/pkg/storage/utils/metadata"
|
||||||
"go.opentelemetry.io/otel/attribute"
|
"go.opentelemetry.io/otel/attribute"
|
||||||
"go.opentelemetry.io/otel/codes"
|
"go.opentelemetry.io/otel/codes"
|
||||||
|
grpccodes "google.golang.org/grpc/codes"
|
||||||
|
"google.golang.org/grpc/status"
|
||||||
)
|
)
|
||||||
|
|
||||||
// name is the Tracer name used to identify this instrumentation library.
|
// name is the Tracer name used to identify this instrumentation library.
|
||||||
@@ -95,12 +97,12 @@ func (c *Cache) lockUser(userID string) func() {
|
|||||||
func (c *Cache) Add(ctx context.Context, userID, spaceID string, rs *collaboration.ReceivedShare) error {
|
func (c *Cache) Add(ctx context.Context, userID, spaceID string, rs *collaboration.ReceivedShare) error {
|
||||||
ctx, span := appctx.GetTracerProvider(ctx).Tracer(tracerName).Start(ctx, "Grab lock")
|
ctx, span := appctx.GetTracerProvider(ctx).Tracer(tracerName).Start(ctx, "Grab lock")
|
||||||
unlock := c.lockUser(userID)
|
unlock := c.lockUser(userID)
|
||||||
span.End()
|
|
||||||
span.SetAttributes(attribute.String("cs3.userid", userID))
|
span.SetAttributes(attribute.String("cs3.userid", userID))
|
||||||
|
span.End()
|
||||||
defer unlock()
|
defer unlock()
|
||||||
|
|
||||||
if _, ok := c.ReceivedSpaces.Load(userID); !ok {
|
if _, ok := c.ReceivedSpaces.Load(userID); !ok {
|
||||||
err := c.syncIfStale(ctx, userID)
|
err := c.syncWithRetry(ctx, userID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@@ -139,11 +141,11 @@ func (c *Cache) Add(ctx context.Context, userID, spaceID string, rs *collaborati
|
|||||||
func (c *Cache) Get(ctx context.Context, userID, spaceID, shareID string) (*State, error) {
|
func (c *Cache) Get(ctx context.Context, userID, spaceID, shareID string) (*State, error) {
|
||||||
ctx, span := appctx.GetTracerProvider(ctx).Tracer(tracerName).Start(ctx, "Grab lock")
|
ctx, span := appctx.GetTracerProvider(ctx).Tracer(tracerName).Start(ctx, "Grab lock")
|
||||||
unlock := c.lockUser(userID)
|
unlock := c.lockUser(userID)
|
||||||
span.End()
|
|
||||||
span.SetAttributes(attribute.String("cs3.userid", userID))
|
span.SetAttributes(attribute.String("cs3.userid", userID))
|
||||||
|
span.End()
|
||||||
defer unlock()
|
defer unlock()
|
||||||
|
|
||||||
err := c.syncIfStale(ctx, userID)
|
err := c.syncWithRetry(ctx, userID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@@ -158,8 +160,8 @@ func (c *Cache) Get(ctx context.Context, userID, spaceID, shareID string) (*Stat
|
|||||||
func (c *Cache) Remove(ctx context.Context, userID, spaceID, shareID string) error {
|
func (c *Cache) Remove(ctx context.Context, userID, spaceID, shareID string) error {
|
||||||
ctx, span := appctx.GetTracerProvider(ctx).Tracer(tracerName).Start(ctx, "Grab lock")
|
ctx, span := appctx.GetTracerProvider(ctx).Tracer(tracerName).Start(ctx, "Grab lock")
|
||||||
unlock := c.lockUser(userID)
|
unlock := c.lockUser(userID)
|
||||||
span.End()
|
|
||||||
span.SetAttributes(attribute.String("cs3.userid", userID))
|
span.SetAttributes(attribute.String("cs3.userid", userID))
|
||||||
|
span.End()
|
||||||
defer unlock()
|
defer unlock()
|
||||||
|
|
||||||
ctx, span = appctx.GetTracerProvider(ctx).Tracer(tracerName).Start(ctx, "Remove")
|
ctx, span = appctx.GetTracerProvider(ctx).Tracer(tracerName).Start(ctx, "Remove")
|
||||||
@@ -200,7 +202,7 @@ func (c *Cache) List(ctx context.Context, userID string) (map[string]*Space, err
|
|||||||
unlock := c.lockUser(userID)
|
unlock := c.lockUser(userID)
|
||||||
defer unlock()
|
defer unlock()
|
||||||
|
|
||||||
err := c.syncIfStale(ctx, userID)
|
err := c.syncWithRetry(ctx, userID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@@ -226,7 +228,21 @@ func (c *Cache) List(ctx context.Context, userID string) (map[string]*Space, err
|
|||||||
func isSyncTransient(err error) bool {
|
func isSyncTransient(err error) bool {
|
||||||
_, isTooEarly := err.(errtypes.IsTooEarly)
|
_, isTooEarly := err.(errtypes.IsTooEarly)
|
||||||
_, isInternal := err.(errtypes.IsInternalError)
|
_, isInternal := err.(errtypes.IsInternalError)
|
||||||
return isTooEarly || isInternal
|
return isTooEarly || isInternal || isTransientGRPCStatus(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
// isTransientGRPCStatus catches raw gRPC transport errors that metadata.CS3 never wraps in errtypes.
|
||||||
|
func isTransientGRPCStatus(err error) bool {
|
||||||
|
st, ok := status.FromError(err)
|
||||||
|
if !ok {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
switch st.Code() {
|
||||||
|
case grpccodes.Unavailable, grpccodes.DeadlineExceeded, grpccodes.Canceled, grpccodes.ResourceExhausted:
|
||||||
|
return true
|
||||||
|
default:
|
||||||
|
return false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Cache) retryPersist(ctx context.Context, userID, spaceID string, persistFunc func() error) error {
|
func (c *Cache) retryPersist(ctx context.Context, userID, spaceID string, persistFunc func() error) error {
|
||||||
@@ -235,6 +251,102 @@ func (c *Cache) retryPersist(ctx context.Context, userID, spaceID string, persis
|
|||||||
Str("userID", userID).
|
Str("userID", userID).
|
||||||
Str("spaceID", spaceID).Logger()
|
Str("spaceID", spaceID).Logger()
|
||||||
|
|
||||||
|
bo := backoff.NewExponentialBackOff()
|
||||||
|
bo.InitialInterval = 500 * time.Microsecond
|
||||||
|
bo.Multiplier = 2.0
|
||||||
|
bo.RandomizationFactor = 1.0
|
||||||
|
bo.MaxInterval = 50 * time.Millisecond
|
||||||
|
|
||||||
|
const maxPersistAttempts = 20
|
||||||
|
const maxIterations = 2 * maxPersistAttempts
|
||||||
|
|
||||||
|
var err error
|
||||||
|
needsResync := false
|
||||||
|
persistAttempts := 0
|
||||||
|
for iter := 0; iter < maxIterations && persistAttempts < maxPersistAttempts; iter++ {
|
||||||
|
select {
|
||||||
|
case <-ctx.Done():
|
||||||
|
return ctx.Err()
|
||||||
|
default:
|
||||||
|
}
|
||||||
|
|
||||||
|
if needsResync {
|
||||||
|
// a previous persist attempt failed and the re-read to pick up fresh state
|
||||||
|
// was itself transient; keep retrying the re-read instead of hammering
|
||||||
|
// persistFunc again with the same stale in-memory rss/etag
|
||||||
|
serr := c.sync(ctx, userID)
|
||||||
|
if serr == nil {
|
||||||
|
needsResync = false
|
||||||
|
continue // fresh state is in memory; retry persistFunc next attempt, no need to wait
|
||||||
|
}
|
||||||
|
// keep err at its last real (persist or resync) failure; never let a
|
||||||
|
// budget-exhausting resync success clobber it into a false nil return
|
||||||
|
err = serr
|
||||||
|
if !isSyncTransient(serr) {
|
||||||
|
log.Error().Int("attempt", iter).Err(serr).Msg("lost update: re-read failed, aborting")
|
||||||
|
return serr
|
||||||
|
}
|
||||||
|
log.Warn().Int("attempt", iter).Err(serr).Msg("lost update: re-read before retry")
|
||||||
|
} else {
|
||||||
|
persistAttempts++
|
||||||
|
err = persistFunc()
|
||||||
|
switch {
|
||||||
|
case err == nil:
|
||||||
|
return nil
|
||||||
|
case isTransientGRPCStatus(err):
|
||||||
|
log.Debug().Int("attempt", iter).Err(err).Msg("persist failed: transient gRPC error, retrying")
|
||||||
|
default:
|
||||||
|
switch err.(type) {
|
||||||
|
case errtypes.Aborted:
|
||||||
|
// expected when the if-match etag check fails; on some branches TooEarly also surfaces as Aborted
|
||||||
|
// continue with sync below
|
||||||
|
log.Debug().Int("attempt", iter).Msg("CAS failed: Aborted (etag changed or upload in progress), retrying")
|
||||||
|
case errtypes.PreconditionFailed:
|
||||||
|
// actually, this is the wrong status code and we treat it like errtypes.Aborted because of inconsistencies on the server side
|
||||||
|
// continue with sync below
|
||||||
|
log.Debug().Int("attempt", iter).Msg("CAS failed: PreconditionFailed (etag changed), retrying")
|
||||||
|
case errtypes.AlreadyExists:
|
||||||
|
// CS3 uses an already exists error instead of precondition failed when using an If-None-Match=* header / IfExists flag in the InitiateFileUpload call.
|
||||||
|
// Thas happens when the cache thinks there is no file.
|
||||||
|
// continue with sync below
|
||||||
|
log.Debug().Int("attempt", iter).Msg("CAS failed: AlreadyExists (file created concurrently), retrying")
|
||||||
|
case errtypes.TooEarly:
|
||||||
|
// storage-system has an upload in progress for this node; wait for it to finish
|
||||||
|
// continue with sync below
|
||||||
|
log.Debug().Int("attempt", iter).Msg("CAS failed: TooEarly (upload in progress), retrying")
|
||||||
|
case errtypes.InternalError:
|
||||||
|
// transient backend error (e.g. disk.go's flock contention under write fan-in);
|
||||||
|
// CAS conflicts no longer masquerade as this since storageprovider.go's Aborted/
|
||||||
|
// AlreadyExists mapping fix (b1a5804ec)
|
||||||
|
log.Debug().Int("attempt", iter).Err(err).Msg("persist failed: InternalError (transient), retrying")
|
||||||
|
default:
|
||||||
|
log.Error().Int("attempt", iter).Err(err).Msg("persisting received share failed, giving up")
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
needsResync = true
|
||||||
|
}
|
||||||
|
|
||||||
|
timer := time.NewTimer(bo.NextBackOff())
|
||||||
|
select {
|
||||||
|
case <-timer.C:
|
||||||
|
case <-ctx.Done():
|
||||||
|
timer.Stop()
|
||||||
|
return ctx.Err()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
// syncWithRetry retries sync's cold-start read on transient errors, since
|
||||||
|
// Add/Get/List call it directly with no other retry wrapper around it.
|
||||||
|
func (c *Cache) syncWithRetry(ctx context.Context, userID string) error {
|
||||||
|
bo := backoff.NewExponentialBackOff()
|
||||||
|
bo.InitialInterval = 500 * time.Microsecond
|
||||||
|
bo.Multiplier = 2.0
|
||||||
|
bo.RandomizationFactor = 1.0
|
||||||
|
bo.MaxInterval = 50 * time.Millisecond
|
||||||
|
|
||||||
var err error
|
var err error
|
||||||
for attempt := 0; attempt < 20; attempt++ {
|
for attempt := 0; attempt < 20; attempt++ {
|
||||||
select {
|
select {
|
||||||
@@ -242,52 +354,27 @@ func (c *Cache) retryPersist(ctx context.Context, userID, spaceID string, persis
|
|||||||
return ctx.Err()
|
return ctx.Err()
|
||||||
default:
|
default:
|
||||||
}
|
}
|
||||||
err = persistFunc()
|
err = c.sync(ctx, userID)
|
||||||
switch err.(type) {
|
if err == nil {
|
||||||
case nil:
|
|
||||||
return nil
|
return nil
|
||||||
case errtypes.Aborted:
|
}
|
||||||
// this is the expected status code from the server when the if-match etag check fails
|
if !isSyncTransient(err) {
|
||||||
// continue with sync below
|
|
||||||
log.Debug().Int("attempt", attempt).Msg("CAS failed: Aborted (etag changed), retrying")
|
|
||||||
case errtypes.PreconditionFailed:
|
|
||||||
// actually, this is the wrong status code and we treat it like errtypes.Aborted because of inconsistencies on the server side
|
|
||||||
// continue with sync below
|
|
||||||
log.Debug().Int("attempt", attempt).Msg("CAS failed: PreconditionFailed (etag changed), retrying")
|
|
||||||
case errtypes.AlreadyExists:
|
|
||||||
// CS3 uses an already exists error instead of precondition failed when using an If-None-Match=* header / IfExists flag in the InitiateFileUpload call.
|
|
||||||
// Thas happens when the cache thinks there is no file.
|
|
||||||
// continue with sync below
|
|
||||||
log.Debug().Int("attempt", attempt).Msg("CAS failed: AlreadyExists (file created concurrently), retrying")
|
|
||||||
case errtypes.TooEarly:
|
|
||||||
// storage-system has an upload in progress for this node; wait for it to finish
|
|
||||||
// continue with sync below
|
|
||||||
log.Debug().Int("attempt", attempt).Msg("CAS failed: TooEarly (upload in progress), retrying")
|
|
||||||
default:
|
|
||||||
log.Error().Int("attempt", attempt).Err(err).Msg("persisting received share failed, giving up")
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
timer := time.NewTimer(expBackoff(attempt))
|
timer := time.NewTimer(bo.NextBackOff())
|
||||||
select {
|
select {
|
||||||
case <-timer.C:
|
case <-timer.C:
|
||||||
case <-ctx.Done():
|
case <-ctx.Done():
|
||||||
timer.Stop()
|
timer.Stop()
|
||||||
return ctx.Err()
|
return ctx.Err()
|
||||||
}
|
}
|
||||||
if serr := c.syncIfStale(ctx, userID); serr != nil {
|
|
||||||
if !isSyncTransient(serr) {
|
|
||||||
log.Error().Int("attempt", attempt).Err(serr).Msg("lost update: re-read failed, aborting")
|
|
||||||
return serr
|
|
||||||
}
|
|
||||||
log.Warn().Int("attempt", attempt).Err(serr).Msg("lost update: re-read before retry")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// syncIfStale pulls the authoritative state from storage when the local replica is stale; caller must hold the user lock.
|
// sync pulls the authoritative state from storage; caller must hold the user lock.
|
||||||
func (c *Cache) syncIfStale(ctx context.Context, userID string) error {
|
func (c *Cache) sync(ctx context.Context, userID string) error {
|
||||||
ctx, span := appctx.GetTracerProvider(ctx).Tracer(tracerName).Start(ctx, "SyncIfStale")
|
ctx, span := appctx.GetTracerProvider(ctx).Tracer(tracerName).Start(ctx, "Sync")
|
||||||
defer span.End()
|
defer span.End()
|
||||||
span.SetAttributes(attribute.String("cs3.userid", userID))
|
span.SetAttributes(attribute.String("cs3.userid", userID))
|
||||||
|
|
||||||
@@ -308,9 +395,6 @@ func (c *Cache) syncIfStale(ctx context.Context, userID string) error {
|
|||||||
span.AddEvent("updating local cache")
|
span.AddEvent("updating local cache")
|
||||||
case errtypes.NotFound:
|
case errtypes.NotFound:
|
||||||
span.SetStatus(codes.Ok, "")
|
span.SetStatus(codes.Ok, "")
|
||||||
if err := c.persist(ctx, userID); err != nil {
|
|
||||||
log.Warn().Err(err).Msg("failed to create empty received share cache file")
|
|
||||||
}
|
|
||||||
return nil
|
return nil
|
||||||
case errtypes.NotModified:
|
case errtypes.NotModified:
|
||||||
span.SetStatus(codes.Ok, "")
|
span.SetStatus(codes.Ok, "")
|
||||||
@@ -386,17 +470,6 @@ func (c *Cache) persist(ctx context.Context, userID string) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// expBackoff returns full-jitter delay: rand(0, min(100ms, 2^attempt ms)).
|
|
||||||
// attempt: 0 1 2 3 4 5 6 7+
|
|
||||||
// max ms: 1 2 4 8 16 32 64 100
|
|
||||||
func expBackoff(attempt int) time.Duration {
|
|
||||||
base := time.Duration(1<<uint(attempt)) * time.Millisecond
|
|
||||||
if base > 100*time.Millisecond {
|
|
||||||
base = 100 * time.Millisecond
|
|
||||||
}
|
|
||||||
return time.Duration(rand.Int64N(int64(base) + 1))
|
|
||||||
}
|
|
||||||
|
|
||||||
func userJSONPath(userID string) string {
|
func userJSONPath(userID string) string {
|
||||||
return filepath.Join("/users", userID, "received.json")
|
return filepath.Join("/users", userID, "received.json")
|
||||||
}
|
}
|
||||||
|
|||||||
Generated
Vendored
+3
@@ -1128,6 +1128,9 @@ func (fs *Decomposedfs) Download(ctx context.Context, ref *provider.Reference, o
|
|||||||
}
|
}
|
||||||
var reader io.ReadCloser
|
var reader io.ReadCloser
|
||||||
if openReaderFunc(ri) {
|
if openReaderFunc(ri) {
|
||||||
|
if n.IsProcessing(ctx) {
|
||||||
|
return nil, nil, errtypes.TooEarly(n.ID)
|
||||||
|
}
|
||||||
reader, err = fs.tp.ReadBlob(n)
|
reader, err = fs.tp.ReadBlob(n)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, errors.Wrap(err, "Decomposedfs: error download blob '"+n.ID+"'")
|
return nil, nil, errors.Wrap(err, "Decomposedfs: error download blob '"+n.ID+"'")
|
||||||
|
|||||||
-2
@@ -135,7 +135,6 @@ func (fs *Decomposedfs) InitiateUpload(ctx context.Context, ref *provider.Refere
|
|||||||
_, span := tracer.Start(ctx, "InitiateUpload")
|
_, span := tracer.Start(ctx, "InitiateUpload")
|
||||||
defer span.End()
|
defer span.End()
|
||||||
log := appctx.GetLogger(ctx)
|
log := appctx.GetLogger(ctx)
|
||||||
log.Debug().Interface("ref", ref).Msg("decomposedfs:InitiateUpload:start")
|
|
||||||
|
|
||||||
// remember the path from the reference
|
// remember the path from the reference
|
||||||
refpath := ref.GetPath()
|
refpath := ref.GetPath()
|
||||||
@@ -336,7 +335,6 @@ func (fs *Decomposedfs) InitiateUpload(ctx context.Context, ref *provider.Refere
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Debug().Str("uploadid", session.ID()).Msg("decomposedfs:InitiateUpload:complete")
|
|
||||||
return map[string]string{
|
return map[string]string{
|
||||||
"simple": session.ID(),
|
"simple": session.ID(),
|
||||||
"tus": session.ID(),
|
"tus": session.ID(),
|
||||||
|
|||||||
Generated
Vendored
+1
-4
@@ -114,13 +114,12 @@ func (session *OcisSession) GetReader(ctx context.Context) (io.ReadCloser, error
|
|||||||
// implements tusd.DataStore interface
|
// implements tusd.DataStore interface
|
||||||
// returns tusd errors
|
// returns tusd errors
|
||||||
func (session *OcisSession) FinishUpload(ctx context.Context) error {
|
func (session *OcisSession) FinishUpload(ctx context.Context) error {
|
||||||
log := appctx.GetLogger(ctx)
|
|
||||||
log.Debug().Msg("decomposedfs:FinishUpload:start")
|
|
||||||
err := session.FinishUploadDecomposed(ctx)
|
err := session.FinishUploadDecomposed(ctx)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// this is part of the tusd integration and we might be able to
|
// this is part of the tusd integration and we might be able to
|
||||||
// log the error in another place
|
// log the error in another place
|
||||||
|
log := appctx.GetLogger(ctx)
|
||||||
log.Error().Err(err).Msg("failed to finish upload")
|
log.Error().Err(err).Msg("failed to finish upload")
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -141,7 +140,6 @@ func (session *OcisSession) FinishUploadDecomposed(ctx context.Context) error {
|
|||||||
ctx, span := tracer.Start(session.Context(ctx), "FinishUpload")
|
ctx, span := tracer.Start(session.Context(ctx), "FinishUpload")
|
||||||
defer span.End()
|
defer span.End()
|
||||||
log := appctx.GetLogger(ctx)
|
log := appctx.GetLogger(ctx)
|
||||||
log.Debug().Str("session", session.ID()).Msg("decomposedfs:FinishUploadDecomposed:start")
|
|
||||||
|
|
||||||
ctx = ctxpkg.ContextSetInitiator(ctx, session.InitiatorID())
|
ctx = ctxpkg.ContextSetInitiator(ctx, session.InitiatorID())
|
||||||
|
|
||||||
@@ -248,7 +246,6 @@ func (session *OcisSession) FinishUploadDecomposed(ctx context.Context) error {
|
|||||||
metrics.UploadSessionsFinalized.Inc()
|
metrics.UploadSessionsFinalized.Inc()
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Debug().Str("session", session.ID()).Msg("decomposedfs:FinishUploadDecomposed:complete")
|
|
||||||
return session.store.tp.Propagate(ctx, n, session.SizeDiff())
|
return session.store.tp.Propagate(ctx, n, session.SizeDiff())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+6
-1
@@ -127,10 +127,15 @@ func acquireLock(file string, write bool) (*flock.Flock, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if !ok {
|
if !ok {
|
||||||
err = ErrAcquireLockFailed
|
// never actually acquired the OS-level lock; release the local
|
||||||
|
// bookkeeping entry too, or every future call for this path is
|
||||||
|
// permanently wedged regardless of whether the real lock clears
|
||||||
|
releaseMutexedFlock(n)
|
||||||
|
return nil, ErrAcquireLockFailed
|
||||||
}
|
}
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
releaseMutexedFlock(n)
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return flock, nil
|
return flock, nil
|
||||||
|
|||||||
+36
@@ -0,0 +1,36 @@
|
|||||||
|
package metadata
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"sync"
|
||||||
|
"sync/atomic"
|
||||||
|
)
|
||||||
|
|
||||||
|
// BarrierStorage wraps a Storage and holds Upload calls until n goroutines have
|
||||||
|
// arrived, then releases them all at once, to deterministically reproduce
|
||||||
|
// concurrent-write races in tests.
|
||||||
|
type BarrierStorage struct {
|
||||||
|
Storage
|
||||||
|
arrived int32
|
||||||
|
n int32
|
||||||
|
ready chan struct{}
|
||||||
|
closeOnce sync.Once
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewBarrierStorage returns a BarrierStorage wrapping s that releases once n Upload calls have arrived.
|
||||||
|
func NewBarrierStorage(s Storage, n int) *BarrierStorage {
|
||||||
|
return &BarrierStorage{Storage: s, n: int32(n), ready: make(chan struct{})}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Upload blocks until n calls have arrived, then delegates to the wrapped Storage.
|
||||||
|
func (b *BarrierStorage) Upload(ctx context.Context, req UploadRequest) (*UploadResponse, error) {
|
||||||
|
if atomic.AddInt32(&b.arrived, 1) >= b.n {
|
||||||
|
b.closeOnce.Do(func() { close(b.ready) })
|
||||||
|
}
|
||||||
|
select {
|
||||||
|
case <-b.ready:
|
||||||
|
case <-ctx.Done():
|
||||||
|
return nil, ctx.Err()
|
||||||
|
}
|
||||||
|
return b.Storage.Upload(ctx, req)
|
||||||
|
}
|
||||||
-11
@@ -39,7 +39,6 @@ import (
|
|||||||
"google.golang.org/grpc/metadata"
|
"google.golang.org/grpc/metadata"
|
||||||
|
|
||||||
"github.com/owncloud/reva/v2/internal/http/services/owncloud/ocdav/net"
|
"github.com/owncloud/reva/v2/internal/http/services/owncloud/ocdav/net"
|
||||||
"github.com/owncloud/reva/v2/pkg/appctx"
|
|
||||||
ctxpkg "github.com/owncloud/reva/v2/pkg/ctx"
|
ctxpkg "github.com/owncloud/reva/v2/pkg/ctx"
|
||||||
"github.com/owncloud/reva/v2/pkg/errtypes"
|
"github.com/owncloud/reva/v2/pkg/errtypes"
|
||||||
"github.com/owncloud/reva/v2/pkg/rgrpc/todo/pool"
|
"github.com/owncloud/reva/v2/pkg/rgrpc/todo/pool"
|
||||||
@@ -65,7 +64,6 @@ type CS3 struct {
|
|||||||
dataGatewayClient *http.Client
|
dataGatewayClient *http.Client
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// NewCS3 returns a new CS3 instance. Use an authenticated context and be sure to define SpaceRoot manually.
|
// NewCS3 returns a new CS3 instance. Use an authenticated context and be sure to define SpaceRoot manually.
|
||||||
func NewCS3(gwAddr, providerAddr string) (s *CS3) {
|
func NewCS3(gwAddr, providerAddr string) (s *CS3) {
|
||||||
return &CS3{
|
return &CS3{
|
||||||
@@ -164,8 +162,6 @@ func (cs3 *CS3) SimpleUpload(ctx context.Context, uploadpath string, content []b
|
|||||||
ctx, span := tracer.Start(ctx, "SimpleUpload")
|
ctx, span := tracer.Start(ctx, "SimpleUpload")
|
||||||
defer span.End()
|
defer span.End()
|
||||||
|
|
||||||
log := appctx.GetLogger(ctx)
|
|
||||||
log.Debug().Str("path", uploadpath).Msg("cs3.SimpleUpload.start")
|
|
||||||
_, err := cs3.Upload(ctx, UploadRequest{
|
_, err := cs3.Upload(ctx, UploadRequest{
|
||||||
Path: uploadpath,
|
Path: uploadpath,
|
||||||
Content: content,
|
Content: content,
|
||||||
@@ -178,9 +174,6 @@ func (cs3 *CS3) Upload(ctx context.Context, req UploadRequest) (*UploadResponse,
|
|||||||
ctx, span := tracer.Start(ctx, "Upload")
|
ctx, span := tracer.Start(ctx, "Upload")
|
||||||
defer span.End()
|
defer span.End()
|
||||||
|
|
||||||
log := appctx.GetLogger(ctx)
|
|
||||||
log.Debug().Str("path", req.Path).Msg("cs3.Upload.start")
|
|
||||||
|
|
||||||
client, err := cs3.providerClient()
|
client, err := cs3.providerClient()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@@ -245,8 +238,6 @@ func (cs3 *CS3) Upload(ctx context.Context, req UploadRequest) (*UploadResponse,
|
|||||||
return nil, errors.New("metadata storage doesn't support the simple upload protocol")
|
return nil, errors.New("metadata storage doesn't support the simple upload protocol")
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Debug().Str("path", req.Path).Str("endpoint", endpoint).Msg("cs3.Upload.initiate_done")
|
|
||||||
|
|
||||||
httpReq, err := http.NewRequest(http.MethodPut, endpoint, bytes.NewReader(req.Content))
|
httpReq, err := http.NewRequest(http.MethodPut, endpoint, bytes.NewReader(req.Content))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@@ -262,7 +253,6 @@ func (cs3 *CS3) Upload(ctx context.Context, req UploadRequest) (*UploadResponse,
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
defer resp.Body.Close()
|
defer resp.Body.Close()
|
||||||
log.Debug().Str("path", req.Path).Int("status", resp.StatusCode).Msg("cs3.Upload.put_done")
|
|
||||||
if err := errtypes.NewErrtypeFromHTTPStatusCode(resp.StatusCode, httpReq.URL.Path); err != nil {
|
if err := errtypes.NewErrtypeFromHTTPStatusCode(resp.StatusCode, httpReq.URL.Path); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@@ -270,7 +260,6 @@ func (cs3 *CS3) Upload(ctx context.Context, req UploadRequest) (*UploadResponse,
|
|||||||
if ocEtag := resp.Header.Get("OC-ETag"); ocEtag != "" {
|
if ocEtag := resp.Header.Get("OC-ETag"); ocEtag != "" {
|
||||||
etag = ocEtag
|
etag = ocEtag
|
||||||
}
|
}
|
||||||
log.Debug().Str("path", req.Path).Str("etag", etag).Msg("cs3.Upload.complete")
|
|
||||||
return &UploadResponse{
|
return &UploadResponse{
|
||||||
Etag: etag,
|
Etag: etag,
|
||||||
FileID: resp.Header.Get("OC-Fileid"),
|
FileID: resp.Header.Get("OC-Fileid"),
|
||||||
|
|||||||
+33
-4
@@ -30,7 +30,9 @@ import (
|
|||||||
|
|
||||||
provider "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1"
|
provider "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1"
|
||||||
typesv1beta1 "github.com/cs3org/go-cs3apis/cs3/types/v1beta1"
|
typesv1beta1 "github.com/cs3org/go-cs3apis/cs3/types/v1beta1"
|
||||||
|
"github.com/google/renameio/v2"
|
||||||
"github.com/owncloud/reva/v2/pkg/errtypes"
|
"github.com/owncloud/reva/v2/pkg/errtypes"
|
||||||
|
"github.com/owncloud/reva/v2/pkg/storage/utils/filelocks"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Disk represents a disk metadata storage
|
// Disk represents a disk metadata storage
|
||||||
@@ -91,8 +93,22 @@ func (disk *Disk) SimpleUpload(ctx context.Context, uploadpath string, content [
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Upload stores a file on disk
|
// Upload stores a file on disk
|
||||||
func (disk *Disk) Upload(_ context.Context, req UploadRequest) (*UploadResponse, error) {
|
func (disk *Disk) Upload(_ context.Context, req UploadRequest) (res *UploadResponse, err error) {
|
||||||
p := disk.targetPath(req.Path)
|
p := disk.targetPath(req.Path)
|
||||||
|
|
||||||
|
// Serialize check+write across processes to eliminate the TOCTOU race.
|
||||||
|
lock, err := filelocks.AcquireWriteLock(p)
|
||||||
|
if err != nil {
|
||||||
|
// transient under high write fan-in; classify so callers retry instead of aborting
|
||||||
|
return nil, errtypes.InternalError(fmt.Sprintf("acquiring write lock: %s", err))
|
||||||
|
}
|
||||||
|
defer func() {
|
||||||
|
rerr := filelocks.ReleaseLock(lock)
|
||||||
|
if err == nil {
|
||||||
|
err = rerr
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
if req.IfMatchEtag != "" {
|
if req.IfMatchEtag != "" {
|
||||||
info, err := os.Stat(p)
|
info, err := os.Stat(p)
|
||||||
if err != nil && !errors.Is(err, os.ErrNotExist) {
|
if err != nil && !errors.Is(err, os.ErrNotExist) {
|
||||||
@@ -107,6 +123,14 @@ func (disk *Disk) Upload(_ context.Context, req UploadRequest) (*UploadResponse,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
for _, v := range req.IfNoneMatch {
|
||||||
|
if v == "*" {
|
||||||
|
if _, err := os.Stat(p); err == nil {
|
||||||
|
return nil, errtypes.AlreadyExists(p)
|
||||||
|
}
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
if req.IfUnmodifiedSince != (time.Time{}) {
|
if req.IfUnmodifiedSince != (time.Time{}) {
|
||||||
info, err := os.Stat(p)
|
info, err := os.Stat(p)
|
||||||
if err != nil && !errors.Is(err, os.ErrNotExist) {
|
if err != nil && !errors.Is(err, os.ErrNotExist) {
|
||||||
@@ -117,8 +141,7 @@ func (disk *Disk) Upload(_ context.Context, req UploadRequest) (*UploadResponse,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
err := os.WriteFile(p, req.Content, 0644)
|
if err := renameio.WriteFile(p, req.Content, 0644); err != nil {
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -126,7 +149,7 @@ func (disk *Disk) Upload(_ context.Context, req UploadRequest) (*UploadResponse,
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
res := &UploadResponse{}
|
res = &UploadResponse{}
|
||||||
res.Etag, err = calcEtag(info.ModTime(), info.Size())
|
res.Etag, err = calcEtag(info.ModTime(), info.Size())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@@ -160,6 +183,12 @@ func (disk *Disk) Download(_ context.Context, req DownloadRequest) (*DownloadRes
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for _, etag := range req.IfNoneMatch {
|
||||||
|
if etag == res.Etag {
|
||||||
|
return nil, errtypes.NotModified(req.Path)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
res.Content, err = io.ReadAll(f)
|
res.Content, err = io.ReadAll(f)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|||||||
+6
@@ -522,6 +522,12 @@ func (t *http2Server) operateHeaders(ctx context.Context, frame *http2.MetaHeade
|
|||||||
delete(mdata, "host")
|
delete(mdata, "host")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If :authority is still missing, i.e. no host or :authority header is
|
||||||
|
// present, reject the request as invalid.
|
||||||
|
if len(mdata[":authority"]) == 0 {
|
||||||
|
t.writeEarlyAbort(streamID, s.contentSubtype, status.New(codes.Internal, "no host or :authority header present"), http.StatusBadRequest, !frame.StreamEnded())
|
||||||
|
return nil
|
||||||
|
}
|
||||||
if frame.StreamEnded() {
|
if frame.StreamEnded() {
|
||||||
// s is just created by the caller. No lock needed.
|
// s is just created by the caller. No lock needed.
|
||||||
s.state = streamReadDone
|
s.state = streamReadDone
|
||||||
|
|||||||
+1
-1
@@ -19,4 +19,4 @@
|
|||||||
package grpc
|
package grpc
|
||||||
|
|
||||||
// Version is the current grpc version.
|
// Version is the current grpc version.
|
||||||
const Version = "1.83.1"
|
const Version = "1.83.2"
|
||||||
Vendored
+2
-2
@@ -1325,7 +1325,7 @@ github.com/orcaman/concurrent-map
|
|||||||
# github.com/owncloud/libre-graph-api-go v1.0.5-0.20260216101009-eeac018af245
|
# github.com/owncloud/libre-graph-api-go v1.0.5-0.20260216101009-eeac018af245
|
||||||
## explicit; go 1.18
|
## explicit; go 1.18
|
||||||
github.com/owncloud/libre-graph-api-go
|
github.com/owncloud/libre-graph-api-go
|
||||||
# github.com/owncloud/reva/v2 v2.0.0-20260910093159-40663c5bb3cb
|
# github.com/owncloud/reva/v2 v2.0.0-20261001074810-94c6e48f5c45
|
||||||
## explicit; go 1.24.0
|
## explicit; go 1.24.0
|
||||||
github.com/owncloud/reva/v2/cmd/revad/internal/grace
|
github.com/owncloud/reva/v2/cmd/revad/internal/grace
|
||||||
github.com/owncloud/reva/v2/cmd/revad/runtime
|
github.com/owncloud/reva/v2/cmd/revad/runtime
|
||||||
@@ -2419,7 +2419,7 @@ google.golang.org/genproto/googleapis/api/httpbody
|
|||||||
## explicit; go 1.25.0
|
## explicit; go 1.25.0
|
||||||
google.golang.org/genproto/googleapis/rpc/errdetails
|
google.golang.org/genproto/googleapis/rpc/errdetails
|
||||||
google.golang.org/genproto/googleapis/rpc/status
|
google.golang.org/genproto/googleapis/rpc/status
|
||||||
# google.golang.org/grpc v1.83.1
|
# google.golang.org/grpc v1.83.2
|
||||||
## explicit; go 1.25.0
|
## explicit; go 1.25.0
|
||||||
google.golang.org/grpc
|
google.golang.org/grpc
|
||||||
google.golang.org/grpc/attributes
|
google.golang.org/grpc/attributes
|
||||||
|
|||||||
Reference in new issue
Block a user