From 0a25083fdbbb1e8cf7067813f29cfff1c575efbc Mon Sep 17 00:00:00 2001 From: Krishnan Parthasarathi Date: Wed, 8 Nov 2023 20:00:02 -0800 Subject: [PATCH] Tiered objects require ns locks unlike inlined (#18409) --- .github/workflows/vulncheck.yml | 2 +- cmd/storage-datatypes.go | 6 +++++- cmd/xl-storage-format-v2.go | 5 +++++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/.github/workflows/vulncheck.yml b/.github/workflows/vulncheck.yml index d263b16f1..25899b942 100644 --- a/.github/workflows/vulncheck.yml +++ b/.github/workflows/vulncheck.yml @@ -22,7 +22,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v3 with: - go-version: 1.21.3 + go-version: 1.21.4 check-latest: true - name: Get official govulncheck run: go install golang.org/x/vuln/cmd/govulncheck@latest diff --git a/cmd/storage-datatypes.go b/cmd/storage-datatypes.go index 7595ddadb..beab78045 100644 --- a/cmd/storage-datatypes.go +++ b/cmd/storage-datatypes.go @@ -296,7 +296,11 @@ func (fi FileInfo) GetDataDir() string { // InlineData returns true if object contents are inlined alongside its metadata. func (fi FileInfo) InlineData() bool { _, ok := fi.Metadata[ReservedMetadataPrefixLower+"inline-data"] - return ok + // Earlier MinIO versions didn't reset "x-minio-internal-inline-data" + // from fi.Metadata when the object was tiered. So, tiered objects + // would return true for InlineData() in these versions even though the + // object isn't inlined in xl.meta + return ok && !fi.IsRemote() } // SetInlineData marks object (version) as inline. diff --git a/cmd/xl-storage-format-v2.go b/cmd/xl-storage-format-v2.go index efaf19c50..2531f233e 100644 --- a/cmd/xl-storage-format-v2.go +++ b/cmd/xl-storage-format-v2.go @@ -536,6 +536,10 @@ func (j xlMetaV2Object) InlineData() bool { return ok } +func (j *xlMetaV2Object) ResetInlineData() { + delete(j.MetaSys, ReservedMetadataPrefixLower+"inline-data") +} + const ( metaTierStatus = ReservedMetadataPrefixLower + TransitionStatus metaTierObjName = ReservedMetadataPrefixLower + TransitionedObjectName @@ -1440,6 +1444,7 @@ func (x *xlMetaV2) DeleteVersion(fi FileInfo) (string, error) { err = x.setIdx(i, *ver) case fi.TransitionStatus == lifecycle.TransitionComplete: ver.ObjectV2.SetTransition(fi) + ver.ObjectV2.ResetInlineData() err = x.setIdx(i, *ver) default: x.versions = append(x.versions[:i], x.versions[i+1:]...)