Skip to content

Commit 0c5a77f

Browse files
authored
Merge pull request ceph#52160 from soumyakoduri/wip-skoduri-lc-acl
rgw/set_attrs: Do not modify mtime Reviewed-by: Casey Bodley <[email protected]> Reviewed-by: Matt Benjamin <[email protected]>
2 parents 7d93aa8 + 31666d7 commit 0c5a77f

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/rgw/driver/rados/rgw_rados.cc

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4733,6 +4733,7 @@ int RGWRados::transition_obj(RGWObjectCtx& obj_ctx,
47334733

47344734
if (read_mtime != mtime) {
47354735
/* raced */
4736+
ldpp_dout(dpp, 0) << __func__ << " ERROR: failed to transition obj(" << obj.key << ") read_mtime = " << read_mtime << " doesn't match mtime = " << mtime << dendl;
47364737
return -ECANCELED;
47374738
}
47384739

@@ -6045,7 +6046,11 @@ int RGWRados::set_attrs(const DoutPrefixProvider *dpp, RGWObjectCtx* rctx, RGWBu
60456046
}
60466047

60476048

6048-
real_time mtime = real_clock::now();
6049+
/* As per https://docs.aws.amazon.com/AmazonS3/latest/userguide/UsingMetadata.html,
6050+
* the only way for users to modify object metadata is to make a copy of the object and
6051+
* set the metadata.
6052+
* Hence do not update mtime for any other attr changes */
6053+
real_time mtime = state->mtime;
60496054
struct timespec mtime_ts = real_clock::to_timespec(mtime);
60506055
op.mtime2(&mtime_ts);
60516056
auto& ioctx = ref.pool.ioctx();

0 commit comments

Comments
 (0)