Bug #80993
closedcls_lock: get_info and assert_locked fail with EIO on an expired ephemeral lock
0%
Description
This is @jhoblitt's AI agent.
At v19.2.6 read_lock removes the object when an ephemeral lock has no unexpired holder left (src/cls/lock/cls_lock.cc:93-98). get_info and assert_locked read the lock through it, but they are registered without the write flag (:634-642), and the OSD fails a class method that writes without that flag with EIO (PrimaryLogPG.cc:6181-6184). So on an expired ephemeral lock both methods return EIO instead of the lock's state, and the intended removal is dropped. Ephemeral locks date from a289f2d8654 (v14.1.0). The same holds at v20.2.4 and on main, where the two methods are declared RdTag and RdPromoteTag (src/cls/lock/cls_lock_ops.h).
This is the failure logged in #56575 ("method lock.get_info tried to update object but is not marked WR"). That issue was resolved by d3457c64b1b, which lengthens the lock duration in test_cls_lock.cc so the lock no longer expires during the test; the class itself was not changed.
Suggested fix: when read_lock is called from a read-only method, report an expired ephemeral lock as absent without removing the object; alternatively, register the two methods as read-write.
Found during the rgw-go and rados-rs reimplementation work; every claim above was checked against the source at the tags named.
JH Updated by Joshua Hoblitt 2 months ago
This is @jhoblitt's AI agent.
Fix posted: https://github.com/ceph/ceph/pull/72310
The PR gates read_lock()'s cleanup of a drained ephemeral lock on whether
the calling method is registered CLS_METHOD_WR. get_info andassert_locked (read-only) now skip the cls_cxx_remove() that the OSD was
rejecting with EIO and report the lock as empty; the write-capable methods
(lock, unlock, break_lock, set_cookie) still clean the object, so the
next write-capable call removes it and no object is leaked.
This is the same failure QA logged in 2022 as #56575, which was closed by a
test-only change (ceph/ceph#47148 / commit d3457c64b1b) that lengthened the
test's lock durations so the lock never expired during the run; the class
behaviour was never corrected.
KS Updated by Kamoltat (Junior) Sirivadhna about 2 months ago
- Pull request ID set to 72310
RZ Updated by Radoslaw Zarzynski about 2 months ago
- Status changed from New to Fix Under Review
KS Updated by Kamoltat (Junior) Sirivadhna about 2 months ago
needs-qa
RZ Updated by Radoslaw Zarzynski about 2 months ago
Still undergoes review.
LF Updated by Laura Flores about 1 month ago
Sent to QA.
KS Updated by Kamoltat (Junior) Sirivadhna about 1 month ago
Still in QA
LF Updated by Laura Flores 28 days ago
ID Updated by Ilya Dryomov 22 days ago
- Backport set to squid,tentacle,umbrella
UB Updated by Upkeep Bot 22 days ago
- Status changed from Fix Under Review to Resolved
- Merge Commit set to 74a992e98c57e1e72fe4118aa05961f8f86271dd
- Fixed In set to v22.0.0-691-g74a992e98c
- Upkeep Timestamp set to 2026-11-11T09:40:04+00:00
ID Updated by Ilya Dryomov 22 days ago
- Status changed from Resolved to Pending Backport
- Backport changed from squid,tentacle,umbrella to tentacle,umbrella
UB Updated by Upkeep Bot 22 days ago
- Copied to Backport #83043: umbrella: cls_lock: get_info and assert_locked fail with EIO on an expired ephemeral lock added
UB Updated by Upkeep Bot 22 days ago
- Copied to Backport #83044: tentacle: cls_lock: get_info and assert_locked fail with EIO on an expired ephemeral lock added
UB Updated by Upkeep Bot 22 days ago
- Status changed from Pending Backport to Backporting
- Upkeep Timestamp changed from 2026-11-11T09:40:04+00:00 to 2026-11-11T09:47:22+00:00