From d0f4cc89a5d0ca45e7ba00fbb7733c2fead3f44e Mon Sep 17 00:00:00 2001 From: Klaus Post Date: Fri, 10 Feb 2023 19:48:39 +0100 Subject: [PATCH] Re-add Veeam Listing workaround (#16593) --- cmd/erasure-server-pool.go | 12 ++++++++++++ cmd/metacache-server-pool.go | 4 +++- cmd/metacache-set.go | 1 + 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/cmd/erasure-server-pool.go b/cmd/erasure-server-pool.go index 63597169f..5e8d70895 100644 --- a/cmd/erasure-server-pool.go +++ b/cmd/erasure-server-pool.go @@ -1207,6 +1207,7 @@ func (z *erasureServerPools) ListObjectVersions(ctx context.Context, bucket, pre if marker == "" && versionMarker != "" { return loi, NotImplemented{} } + opts := listPathOptions{ Bucket: bucket, Prefix: prefix, @@ -1217,6 +1218,17 @@ func (z *erasureServerPools) ListObjectVersions(ctx context.Context, bucket, pre AskDisks: globalAPIConfig.getListQuorum(), Versioned: true, } + + // Shortcut for APN/1.0 Veeam/1.0 Backup/10.0 + // It requests unique blocks with a specific prefix. + // We skip scanning the parent directory for + // more objects matching the prefix. + ri := logger.GetReqInfo(ctx) + if ri != nil && strings.Contains(ri.UserAgent, `1.0 Veeam/1.0 Backup`) && strings.HasSuffix(prefix, ".blk") { + opts.BaseDir = prefix + opts.Transient = true + } + // set bucket metadata in opts opts.setBucketMeta(ctx) diff --git a/cmd/metacache-server-pool.go b/cmd/metacache-server-pool.go index 6135020eb..38cbff39e 100644 --- a/cmd/metacache-server-pool.go +++ b/cmd/metacache-server-pool.go @@ -96,7 +96,9 @@ func (z *erasureServerPools) listPath(ctx context.Context, o *listPathOptions) ( // Decode and get the optional list id from the marker. o.parseMarker() - o.BaseDir = baseDirFromPrefix(o.Prefix) + if o.BaseDir == "" { + o.BaseDir = baseDirFromPrefix(o.Prefix) + } o.Transient = o.Transient || isReservedOrInvalidBucket(o.Bucket, false) o.SetFilter() if o.Transient { diff --git a/cmd/metacache-set.go b/cmd/metacache-set.go index 9d4e9f231..cce78e24d 100644 --- a/cmd/metacache-set.go +++ b/cmd/metacache-set.go @@ -49,6 +49,7 @@ type listPathOptions struct { Bucket string // Directory inside the bucket. + // When unset listPath will set this based on Prefix BaseDir string // Scan/return only content with prefix.