]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commit
crimson/osd: guard recovery clone overlap with try_lock_for_read 69668/head
authorKautilya Tripathi <kautilya.tripathi@ibm.com>
Mon, 22 Jun 2026 03:28:43 +0000 (08:58 +0530)
committerKautilya Tripathi <kautilya.tripathi@ibm.com>
Thu, 9 Jul 2026 02:11:45 +0000 (07:41 +0530)
commit8a73bcfecc45e1c488c5a6966b77a5bdc318bbbb
tree0e67d4a6d42f0007013ff29c5348e6a05e58a279
parent458deaec5814b1cc20d8b651737ed01c0a77579c
crimson/osd: guard recovery clone overlap with try_lock_for_read

Crimson recovery could use a neighbor clone as a clone_subset source
during osd_recover_clone_overlap without checking whether that clone
was safe to read. Classic OSD takes a read lock on the neighbor clone
via try_lock_for_read() before using it.

Under snap trim + recovery stress, recovery could clone_range from a
clone that snap trim was modifying, producing wrong object content
(ceph_test_rados: incorrect buffer at pos 1462272).

calc_clone_subsets() and calc_head_subsets() now return clone overlap
candidates in preference order only. ReplicatedRecoveryBackend locks
the first usable neighbor clone from each list and holds those read
locks until push/pull recovery completes. RecoveryCloneLockManager
releases locks in its destructor so move-assign cannot leak a held
lock and block snap trim.

Fixes: https://tracker.ceph.com/issues/76499
Signed-off-by: Kautilya Tripathi <kautilya.tripathi@ibm.com>
src/crimson/osd/object_context.h
src/crimson/osd/object_metadata_helper.cc
src/crimson/osd/object_metadata_helper.h
src/crimson/osd/recovery_backend.cc
src/crimson/osd/recovery_backend.h
src/crimson/osd/replicated_recovery_backend.cc
src/crimson/osd/replicated_recovery_backend.h
src/test/crimson/test_calc_subsets.cc