mirror of
https://github.com/pgsty/minio.git
synced 2026-11-10 09:35:31 +03:00
fix(batch): let a write refuse to replace a locked version
Add ObjectOptions.RefuseLockedOverwrite. With it set, PutObject (before the rename) and CompleteMultipartUpload check, under the destination's write lock, the stored version the write would replace: the version it addresses, or the null version. DeleteObject checks the stored version that a delete marker it writes names; in a multi-pool deployment that version is resolved across pools. A version under retention or legal hold is refused with ObjectLocked. The check reads the version's own metadata, whatever the bucket configuration, and returns read errors. Nothing sets the option yet. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Feng Ruohang <rh@vonng.com>
This commit is contained in:
@@ -1277,6 +1277,15 @@ func (z *erasureServerPools) DeleteObject(ctx context.Context, bucket string, ob
|
||||
return z.deleteAllVersions(ctx, bucket, object, opts)
|
||||
}
|
||||
|
||||
// A delete marker that names a version replaces that version in
|
||||
// whichever pool holds it.
|
||||
if opts.RefuseLockedOverwrite && opts.DeleteMarker && opts.VersionID != "" && !z.SinglePool() {
|
||||
goi, gerr := z.replicaObjectInfo(ctx, bucket, object, ObjectOptions{VersionID: opts.VersionID, NoLock: true, NoAuditLog: true})
|
||||
if err := refuseLockedMarkerOverwrite(ctx, bucket, object, opts.VersionID, goi, gerr); err != nil {
|
||||
return ObjectInfo{Name: decodeDirObject(object), VersionID: opts.VersionID}, err
|
||||
}
|
||||
}
|
||||
|
||||
// An ILM expiry is decided on the versions in one pool. Under the lock,
|
||||
// check it with the versions in all pools; the sets then take it as
|
||||
// decided, without a recheck by the versions each one holds. They only
|
||||
|
||||
Reference in New Issue
Block a user