Repository navigation
cls/lock: don't clean an expired ephemeral lock from a read-only method - #72310
Conversation
idryomov
left a comment
There was a problem hiding this comment.
I'd suggest adding a test case to src/test/cls_lock/test_cls_lock.cc that would e.g. set duration to 3 seconds, sleep for 4 seconds, run lock_info() asserting success, run ioctx.stat() asserting that the object is still there, run some write-capable method and finally run ioctx.stat() again asserting that the object is now gone.
|
RGW also uses |
|
This PR has been added to wip-bharath11-testing-20261027.070430-main. |
read_lock() removes the backing object when an ephemeral lock has drained of unexpired holders, via cls_cxx_remove(). get_info and assert_locked are registered read-only (CLS_METHOD_RD, RdTag / RdPromoteTag), so when they reach that path the OSD rejects the write issued by a non-WR method and fails the whole class call with EIO (PrimaryLogPG: "tried to update object but is not marked WR"). Both methods then answer EIO instead of the lock's state, and the cleanup is lost with them. Gate the removal on a may_write flag that read_lock's callers pass: the write-capable methods (lock, unlock, break_lock, set_cookie) still clean the drained object, while the read-only methods skip the removal and report the lock as empty. The next lock replaces the drained lock and that holder's unlock removes the object; the removal was already lost before this change, so nothing new is left behind. https://tracker.ceph.com/issues/56575 logged this same failure in 2022 but was closed by a test-only change (PR ceph#47148) that lengthened the test's lock durations so the lock never expired during the run; the class behaviour was never corrected. Assisted-by: Claude-v2.1.286:claude-opus-4-8 Assisted-by: Claude-v2.1.318:claude-opus-5-5 Fixes: https://tracker.ceph.com/issues/80993 Signed-off-by: Joshua Hoblitt <[email protected]>
6756ea7 to
8291d0c
Compare
@SrinivasaBharath #72310 changed after the QA run in https://tracker.ceph.com/issues/82147. The only change is a new test, |
|
This is an automated message by src/script/redmine-upkeep.py. I have resolved the following tracker ticket due to the merge of this PR: No backports are pending for the ticket. If this is incorrect, please update the tracker |
get_infoandassert_lockedare registered read-only (CLS_METHOD_RD;RdTag/RdPromoteTagon main). When they read an ephemeral lock whoseholders have all expired,
read_lock()removes the now-empty object withcls_cxx_remove(). The OSD rejects that write from a non-WRmethod andfails the whole class call with
EIO(PrimaryLogPG: "tried to updateobject but is not marked WR"), so both methods answer
EIOinstead of thelock's state and the cleanup is lost. Present since ephemeral locks landed in
a289f2d8654(v14.1.0); verified at v19.2.6, v20.2.4 and main.This gates the removal on a
may_writeflag the callers pass: thewrite-capable methods (
lock,unlock,break_lock,set_cookie) stillclean the drained object; the read-only methods skip the removal and report
the lock as empty. The next
lockreplaces the drained lock, and that holder'sunlock removes the object.
#56575 logged this same failure in
2022 but was closed by a test-only change
(ceph/ceph#47148) that lengthened
the test's lock durations so the lock never expired; the class behaviour was
never corrected.
Fixes: https://tracker.ceph.com/issues/80993
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