Repository navigation
rgw: preserve head mtime in olh_cancel_modification() - #72605
Conversation
|
what if a new PUT operation overwrites the null-version object in between, but the rollback moves the head mtime backward. in case of multisite, a zone that already has the previous null version treats the head as unchanged and could skip the update? |
Thank you @smanjara , great catch! Yes, an overwrite of the null version keeps the OLH attrs (cls_rgw_remove_obj() keeps the RGW_ATTR_OLH_PREFIX attrs), including the OLH tag, so the olh tag guard alone doesn't detect it, and the rollback would stamp the old mtime onto the new data. In the new evidence, added a test case to the same file to reproduce this exact same scenario: it holds/delays the rollback, then overwrites the null version in that window, and checks HEAD ?versionId=null and ListObjectVersions report the same LastModified. It fails consistently without the fix and passes with it. The updated fix now:
FWIW, the race you describe here is already there in Below is some result for the new testcase (from a local copy of the test that logs both values instead of asserting): A is the op getting rolled back and B is the overlapping successful write.
|
aabf654 to
e56f204
Compare
Extend the already existing 'original null object version is intact after failed olh upgrade' test case. After the injected set_olh() failure is rolled back, HEAD ?versionId=null must report the same LastModified as the null version's ListObjectVersions entry. That's, HEAD shouldn't report the failed request's time. Signed-off-by: Oguzhan Ozmen <[email protected]>
Add a delay injection point in olh_cancel_modification() so that we can delay the rollback of the pending OLH xattr. This can be used to test scenarios like a concurrent overwrite of the head object in that window. Signed-off-by: Oguzhan Ozmen <[email protected]>
…h an overwrite Hold the rollback of a failed olh upgrade with the "delay_olh_cancel_modification" delay point and overwrite the null version in the meantime. HEAD ?versionId=null must still report the same LastModified as the null version's ListObjectVersions entry. The rollback must not leave its pending OLH xattr behind either. Signed-off-by: Oguzhan Ozmen <[email protected]>
When set_olh() or unlink_obj_instance() fails to update the bucket index, it calls olh_cancel_modification() to roll back the pending OLH xattr. The rollback issues an rmxattr write on the head object without setting an explicit mtime, so RADOS stamped the head with the current time (i.e., now()). This fix preserves the head object's mtime on the rollback write. This fix mirrors what olh_init_modification_impl() and apply_olh_log() already do: pin the mtime when they touch the head. The rollback pins the mtime only if the head's RGW_ATTR_ID_TAG is unchanged. The OLH tag guard alone doesn't catch a concurrent overwrite of the null version, because the overwrite keeps the OLH attrs. If the ID_TAG check fails, we'll re-read the head and retry, pinning its current mtime, which will match the overwrite's bucket index entry. This is best effort: after a few retries, or if the OLH tag changed, the rollback leaves the head alone. A leftover pending xattr is then removed by the existing timeout cleanup. To note: this issue was exposed in LC transitioning. When the head object was colocated with a null version's data, the head's mtime is the null version's mtime. After such a rollback, it no longer matched the mtime recorded in the bucket index entry. While head object mtime reported the failed request's mtime, ListObjectVersions reported the original time, and transition_obj()'s read_mtime check returns -ECANCELED on every lifecycle pass, so the null version can never be transitioned. Fixes: https://tracker.ceph.com/issues/81668 Signed-off-by: Oguzhan Ozmen <[email protected]>
…emoved Leave the pending OLH xattr of a failed olh upgrade on the head, similar to a crash before the rollback, by also skipping olh_cancel_modification() with rgw_debug_inject_olh_cancel_modification_err. Also, lower rgw_olh_pending_timeout_sec so that the next read of the key removes the timed out entry in follow_olh(). HEAD ?versionId=null must still report the same LastModified as the null version's ListObjectVersions entry. Signed-off-by: Oguzhan Ozmen <[email protected]>
…e pending olh entry Leave a timed out pending OLH xattr on the head, as in the previous test case, and then delete the only linked version. clear_olh() removes the timed out entry before removing the OLH head object, so the head object must be gone afterwards. This already passes; it covers the clear_olh() path of the next change. Signed-off-by: Oguzhan Ozmen <[email protected]>
e56f204 to
3c09c18
Compare
follow_olh() and clear_olh() remove pending OLH xattrs older than rgw_olh_pending_timeout_sec through remove_olh_pending_entries(). Such an entry might be left behind if rgw crashes during set_olh() or unlink_obj_instance(), or if olh_cancel_modification() fails to remove it. The removal issues an rmxattr write on the head object without setting an explicit mtime, so RADOS stamped the head with the current time. When the head also holds the null version's data, its mtime no longer matched the null version's bucket index entry. Here, we pin the head's mtime on that write, guarded by RGW_ATTR_ID_TAG like the rollback. The mtime and ID_TAG are read from the head here instead of taking from the caller's state: i.e., in clear_olh(). That state may be cached. The read only happens when timed out entries exist. If the head is overwritten between the read and the write, the guard fails and the entries are left for the next follow_olh() or clear_olh(). Fixes: https://tracker.ceph.com/issues/81668 Signed-off-by: Oguzhan Ozmen <[email protected]>
3c09c18 to
8efa9e1
Compare
|
ceph-ci branch: https://github.com/ceph/ceph-ci/commits/wip-oozmen-testing-olh_cancel_modification-2026-10-29-0100/ Summary90 suites in total: 89 PASSED, 1 FAILED Failed Suite -> rgw/luaThis is a known issue: 2 of 10 lua tests failed, test_multi_delete_obj and test_access_log. Both show assert ['0'..'4'] == [] with UnixSocket: accept timed out. This is a known issue Bug #81310 rgw/lua: test_lua.py::test_access_log FAILED and fix is under review. Not related to this PR. testcases added in this PR to qa/workunits/rgw/test_rgw_versioning.pyEvery
E.g., job 691825 |
Fixes: https://tracker.ceph.com/issues/81668
The existing testcase "TESTCASE 'verify that original null object version is intact after failed olh upgrade'" already shows/reproduces the issue; w/o the fix, the new assert added in this PR triggers.
Contribution Guidelines
To sign and title your commits, please refer to Submitting Patches to Ceph.
If you are submitting a fix for a stable branch (e.g. "quincy"), please refer to Submitting Patches to Ceph - Backports for the proper workflow.
When filling out the below checklist, you may click boxes directly in the GitHub web UI. When entering or editing the entire PR message in the GitHub web UI editor, you may also select a checklist item by adding an
xbetween the brackets:[x]. Spaces and capitalization matter when checking off items this way.Checklist
Show available Jenkins commands
jenkins test classic perfJenkins Job | Jenkins Job Definitionjenkins test crimson perfJenkins Job | Jenkins Job Definitionjenkins test signedJenkins Job | Jenkins Job Definitionjenkins test make checkJenkins Job | Jenkins Job Definitionjenkins test make check arm64Jenkins Job | Jenkins Job Definitionjenkins test submodulesJenkins Job | Jenkins Job Definitionjenkins test dashboardJenkins Job | Jenkins Job Definitionjenkins test dashboard cephadmJenkins Job | Jenkins Job Definitionjenkins test apiJenkins Job | Jenkins Job Definitionjenkins test docsReadTheDocs | Github Workflow Definitionjenkins test ceph-volume allJenkins Jobs | Jenkins Jobs Definitionjenkins test windowsJenkins Job | Jenkins Job Definitionjenkins test rook e2eJenkins Job | Jenkins Job DefinitionYou must only issue one Jenkins command per-comment. Jenkins does not understand
comments with more than one command.