Skip to content

crimson: Implement a lock_excl_wait wrapper - #65849

Merged
Matan-B merged 1 commit into
ceph:mainfrom
mohit84:lock_excl_wait
Nov 6, 2025
Merged

Matan-B merged 1 commit into
ceph:mainfrom
mohit84:lock_excl_wait

Conversation

@mohit84

@mohit84 mohit84 commented Oct 9, 2025 •

Copy link
Copy Markdown
Contributor

The wrapper returns a future immediately if the lock is available otherwise wait asynchronously

Fixes: https://tracker.ceph.com/issues/71861

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 x between the brackets: [x]. Spaces and capitalization matter when checking off items this way.

Checklist

  • Tracker (select at least one)
    • References tracker ticket
    • Very recent bug; references commit where it was introduced
    • New feature (ticket optional)
    • Doc update (no ticket needed)
    • Code cleanup (no ticket needed)
  • Component impact
    • Affects Dashboard, opened tracker ticket
    • Affects Orchestrator, opened tracker ticket
    • No impact that needs to be tracked
  • Documentation (select at least one)
    • Updates relevant documentation
    • No doc update is appropriate
  • Tests (select at least one)
Show available Jenkins commands

You must only issue one Jenkins command per-comment. Jenkins does not understand
comments with more than one command.

@mohit84
mohit84 requested a review from a team as a code owner October 9, 2025 06:58
@mohit84
mohit84 requested a review from athanatos October 9, 2025 06:58
@mohit84
mohit84 requested review from Matan-B and rzarzynski October 9, 2025 06:58

@Matan-B Matan-B left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should work well. The only downside here is that being unable to exl lock an object which was just now recovered is not intuitive. Perhaps it could be helpful to explain in the commit message how/why the lock is already held by load_and_lock.

We could have potentially try to not lock the object prior to it being recovered - which I think is a more robust solution - though I'm ok with merging this approach as well as this issue largely affects the suite.

@Matan-B Matan-B added this to Crimson Oct 9, 2025
@Matan-B Matan-B moved this to Needs QA in Crimson Oct 9, 2025
@Matan-B

Matan-B commented Oct 9, 2025

Copy link
Copy Markdown
Contributor

@mohit84, can you please run this through the suite? Thanks!

@perezjosibm

perezjosibm commented Oct 9, 2025 •

Copy link
Copy Markdown
Contributor
teuthology-suite -m smithi -s crimson-rados -p 101 --force-priority -c wip-perezjos-crimson-only-09-10-2025-PR65849 -f crimson-debug --filter seastore --distro centos --distro-version 9 --suite-branch main --suite-repo https://github.com/ceph/ceph.git # PR65849
2025-10-09 11:55:21,667.667 INFO:teuthology.suite.run:Test results viewable at 

https://pulpito.ceph.com/jjperez-2025-10-09_11:51:02-crimson-rados-wip-perezjos-crimson-only-09-10-2025-PR65849-distro-crimson-debug-smithi/

@mohit84

mohit84 commented Oct 9, 2025

Copy link
Copy Markdown
Contributor Author

@perezjosibm

Copy link
Copy Markdown
Contributor

@mohit84, can you please run this through the suite? Thanks!

https://pulpito.ceph.com/moagrawa-2025-10-09_09:27:16-crimson-rados-main-distro-crimson-debug-smithi/

Apologies, I jumped the gun, will remove my tag

@mohit84

mohit84 commented Oct 9, 2025

Copy link
Copy Markdown
Contributor Author

@mohit84, can you please run this through the suite? Thanks!

https://pulpito.ceph.com/moagrawa-2025-10-09_09:27:16-crimson-rados-main-distro-crimson-debug-smithi/

Apologies, I jumped the gun, will remove my tag

No worries, thanks for the quick follow-up !!

@mohit84

mohit84 commented Oct 10, 2025

Copy link
Copy Markdown
Contributor Author

@mohit84, can you please run this through the suite? Thanks!

https://pulpito.ceph.com/moagrawa-2025-10-09_09:27:16-crimson-rados-main-distro-crimson-debug-smithi/

The two teuthology jobs are generating coredump but not related to this patch, both are related to the known bug https://tracker.ceph.com/issues/73343
./8543355/teuthology.log:failure_reason: Found coredumps on [email protected]
./8543327/teuthology.log:failure_reason: Found coredumps on [email protected]

Rest failures are related to the script/environment specific not related to the patch.

@Matan-B

Matan-B commented Oct 12, 2025

Copy link
Copy Markdown
Contributor

The two teuthology jobs are generating coredump but not related to this patch, both are related to the known bug https://tracker.ceph.com/issues/73343 ./8543355/teuthology.log:failure_reason: Found coredumps on [email protected] ./8543327/teuthology.log:failure_reason: Found coredumps on [email protected]

Rest failures are related to the script/environment specific not related to the patch.

Can you please review in the following format: https://tracker.ceph.com/projects/crimson/wiki/MAIN?
This could help with future reviews and finding regressions quicker.
Thanks!

@Matan-B Matan-B moved this from Needs QA to Tested in Crimson Oct 12, 2025
@mohit84

mohit84 commented Oct 13, 2025

Copy link
Copy Markdown
Contributor Author

The two teuthology jobs are generating coredump but not related to this patch, both are related to the known bug https://tracker.ceph.com/issues/73343 ./8543355/teuthology.log:failure_reason: Found coredumps on [email protected] ./8543327/teuthology.log:failure_reason: Found coredumps on [email protected]
Rest failures are related to the script/environment specific not related to the patch.

Can you please review in the following format: https://tracker.ceph.com/projects/crimson/wiki/MAIN? This could help with future reviews and finding regressions quicker. Thanks!

done

@rzarzynski rzarzynski left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps we want to fix it different way. Please see the comments below.

@@ -899,7 +899,9 @@ ReplicatedRecoveryBackend::_handle_pull_response(
pull_info.stat.num_objects_recovered++;
auto manager = pg.obc_loader.get_obc_manager(
recovery_waiter.obc);
manager.lock_excl_sync(); /* cannot already be locked */

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The current implementation clearly assumes it's the crafting of a pull request cannot interleave with handling the pull response to it. That seems reasonable and, thankfully to the assertions, exposes bugs that could be even nastier than this one.

manager.lock_excl_sync(); /* cannot already be locked */
// Call lock_excl_wait if the lock is already held by load_and_lock_(head|clone)
// and has not been released yet.
co_await interruptor::make_interruptible(manager.lock_excl_wait());

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The patch, although small in terms of SLOCs exchanged, squeezes signalling of breakage of pretty fundamental design assumption from this single piece of the broader pull machinery. My impression is it fights with the symptom instead of the underlying reason on why the assumption is broken.

If this really is all about send_to_osd() being called within with_obc(), then way simpler (from the point-of-view of the entire pull subsystem) change would be to message the peer at the very end, when every single continuation in the chain has finished (send_to_osd() would go to a "dedicated lamba", after the with_obc). How about that?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree it would be more cleaner, i will try the same.

@Matan-B Matan-B moved this from Tested to In Progress in Crimson Oct 15, 2025
@Matan-B
Matan-B self-requested a review October 15, 2025 07:18
@mohit84 mohit84 moved this from In Progress to Awaits review in Crimson Oct 16, 2025
@mohit84

mohit84 commented Oct 22, 2025

Copy link
Copy Markdown
Contributor Author

The job is failing during upload cbt related metrics on the server mira118
https://pulpito.ceph.com/moagrawa-2025-10-19_00:10:55-crimson-rados-main-distro-crimson-debug-smithi/
It is similar to the bug https://tracker.ceph.com/issues/68843, after discussion with @NitzanMordhai
he will disable to perf collect then i will trigger a new job.

@NitzanMordhai

Copy link
Copy Markdown
Contributor

after discussion with @NitzanMordhai
he will disable to perf collect then i will trigger a new job.

I created #66016, Can you cherry-pick the commit to your suites and run your test again?

@Matan-B Matan-B left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, I think the first commit and the revert of it can be removed from the PR.
When testing the PR, can you please --filter-out perf until Nitzan's PR mentioned here is merged? Thanks!

return recovery_waiter.wait_for_pull();
});

return seastar::do_with(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems like a good opportunity to swap to coroutines and avoid do_with.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note, this is not a blocker but a suggestion :)

Comment on lines +139 to +145
return pg.obc_loader.with_obc<RWState::RWREAD>(soid.get_head(),
[this, soid, need, &pull_op](auto head, auto) {
auto& recovery_waiter = get_recovering(soid);
recovery_waiter.pull_info.emplace();
auto &pull_info = *recovery_waiter.pull_info;
prepare_pull(head, pull_op, pull_info, soid, need);
return seastar::now();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Continuing my previous comment here, the with_obc lambda could remain non coroutine to avoid capture lifetime issues.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will handle the same in next patch.

@Matan-B
Matan-B requested a review from xxhdx1985126 October 22, 2025 09:51
@Matan-B Matan-B moved this from Awaits review to In Progress in Crimson Oct 22, 2025
@mohit84

mohit84 commented Oct 24, 2025

Copy link
Copy Markdown
Contributor Author

lgtm, I think the first commit and the revert of it can be removed from the PR. When testing the PR, can you please --filter-out perf until Nitzan's PR mentioned here is merged? Thanks!

https://pulpito.ceph.com/moagrawa-2025-10-23_01:15:05-crimson-rados-main-distro-crimson-debug-smithi/
Total 5 jobs are failed
https://tracker.ceph.com/issues/73314
https://pulpito.ceph.com/moagrawa-2025-10-23_01:15:05-crimson-rados-main-distro-crimson-debug-smithi/8566241/remote/smithi112/log/ceph-osd.2.log.gz
https://pulpito.ceph.com/moagrawa-2025-10-23_01:15:05-crimson-rados-main-distro-crimson-debug-smithi/8566199/remote/smithi022/log/ceph-osd.1.log.gz
https://pulpito.ceph.com/moagrawa-2025-10-23_01:15:05-crimson-rados-main-distro-crimson-debug-smithi/8566263/remote/smithi203/log/ceph-osd.2.log.gz

https://tracker.ceph.com/issues/73169
https://pulpito.ceph.com/moagrawa-2025-10-23_01:15:05-crimson-rados-main-distro-crimson-debug-smithi/8566307/teuthology.log
https://pulpito.ceph.com/moagrawa-2025-10-23_01:15:05-crimson-rados-main-distro-crimson-debug-smithi/8566219/remote/smithi060/log/ceph-osd.0.log.gz

@Matan-B

Matan-B commented Oct 28, 2025

Copy link
Copy Markdown
Contributor

Tests look good!
Can you please remove the first 2 commits? They seem to be kept mistakenly, right?

@Matan-B Matan-B moved this from In Progress to Tested in Crimson Oct 28, 2025
@Matan-B Matan-B added TESTED and removed needs-qa labels Oct 28, 2025
@mohit84

mohit84 commented Oct 29, 2025

Copy link
Copy Markdown
Contributor Author

Tests look good! Can you please remove the first 2 commits? They seem to be kept mistakenly, right?

done

@mohit84

mohit84 commented Oct 29, 2025

Copy link
Copy Markdown
Contributor Author

jenkins test make check

@Matan-B

Matan-B commented Oct 29, 2025

Copy link
Copy Markdown
Contributor

done

Hey, There are still 3 commits in the PR. Can you please take a look?

@mohit84
mohit84 force-pushed the lock_excl_wait branch 2 times, most recently from 40b1dae to a042586 Compare October 30, 2025 05:11
@mohit84

mohit84 commented Oct 30, 2025

Copy link
Copy Markdown
Contributor Author

jenkins test make check

@Matan-B

Matan-B commented Nov 5, 2025

Copy link
Copy Markdown
Contributor

jenkins test docs

@Matan-B

Matan-B commented Nov 5, 2025

Copy link
Copy Markdown
Contributor

https://pulpito.ceph.com/moagrawa-2025-10-23_01:15:05-crimson-rados-main-distro-crimson-debug-smithi/ Total 5 jobs are failed https://tracker.ceph.com/issues/73314 https://pulpito.ceph.com/moagrawa-2025-10-23_01:15:05-crimson-rados-main-distro-crimson-debug-smithi/8566241/remote/smithi112/log/ceph-osd.2.log.gz https://pulpito.ceph.com/moagrawa-2025-10-23_01:15:05-crimson-rados-main-distro-crimson-debug-smithi/8566199/remote/smithi022/log/ceph-osd.1.log.gz https://pulpito.ceph.com/moagrawa-2025-10-23_01:15:05-crimson-rados-main-distro-crimson-debug-smithi/8566263/remote/smithi203/log/ceph-osd.2.log.gz

https://tracker.ceph.com/issues/73169 https://pulpito.ceph.com/moagrawa-2025-10-23_01:15:05-crimson-rados-main-distro-crimson-debug-smithi/8566307/teuthology.log https://pulpito.ceph.com/moagrawa-2025-10-23_01:15:05-crimson-rados-main-distro-crimson-debug-smithi/8566219/remote/smithi060/log/ceph-osd.0.log.gz

When reviewing next time please use the following template and share the analysis in the wiki: https://tracker.ceph.com/projects/crimson/wiki/MAIN

See my note in https://tracker.ceph.com/issues/73169#note-5 I think this is a different bug (IMO). See - https://tracker.ceph.com/issues/73726

Summary:

Failures, unrelated:
- 8566241, 8566199, 8566263 -- https://tracker.ceph.com/issues/73314 - PeeringMachine abort
- 8566307 -- https://tracker.ceph.com/issues/73169 - wait_for_recovery is failing
New:
- 8566219 -- https://tracker.ceph.com/issues/73726 - RecoveryBackend::add_temp_obj

Docs seem to fail not sure why, I'm ok with merging when ci passes!

@Matan-B

Matan-B commented Nov 5, 2025

Copy link
Copy Markdown
Contributor

jenkins test docs

@Matan-B

Matan-B commented Nov 5, 2025

Copy link
Copy Markdown
Contributor

Might need a rebase: #66059

The with_obc() function acquires a lock before invoking the
lambda it wraps. Earlier the lambda itself called send_to_osd()
which returns a future to with_obc. If a future is not resolved
immediately and a response could arrive and trigger
handle_pull_response() which attempts to acquire an exclusive lock.

Because a future is not returned yet to with_obc() so the original
lock is still holding by with_obc and handle_pull_response() throw
an assertion failure due to that osd is crashed.

Solution: Move send_to_osd() call outside with_obc lambda so that
the lock is released before handle_pull_response() is triggered.

Fixed: https://tracker.ceph.com/issues/71861
Signed-off-by: Mohit Agrawal <[email protected]>
@mohit84

mohit84 commented Nov 5, 2025

Copy link
Copy Markdown
Contributor Author

jenkins test docs

@mohit84

mohit84 commented Nov 5, 2025

Copy link
Copy Markdown
Contributor Author

jenkins test make check

@Matan-B
Matan-B merged commit 1f0624f into ceph:main Nov 6, 2025
@Matan-B Matan-B moved this from Tested to Merged (Main) in Crimson Nov 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Merged (Pre Umbrella cutoff)

Development

Successfully merging this pull request may close these issues.

5 participants