Skip to content

osdc/Objecter: release rwlock before complete_op_reply in op_post_split_op_complete - #71520

Merged
MattyWilliams22 merged 1 commit into
ceph:mainfrom
MattyWilliams22:wip-splitop-rwlock-fix
Sep 22, 2026
Merged

MattyWilliams22 merged 1 commit into
ceph:mainfrom
MattyWilliams22:wip-splitop-rwlock-fix

Conversation

@MattyWilliams22

@MattyWilliams22 MattyWilliams22 commented Sep 3, 2026 •

Copy link
Copy Markdown
Contributor

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

Problem

op_post_split_op_complete posts a lambda that acquires a shared lock rl on Objecter::rwlock, then acquires the session lock sl, then calls complete_op_reply — with rl still held. complete_op_reply releases sl internally and then fires the op's onfinish user callback. Because rl is never released before that callback, the callback executes with Objecter::rwlock held.

When the caller is librbd on an EC pool, this creates a lockdep cycle:

image_lock → Objecter::rwlock: recorded whenever librbd issues a RADOS op while holding image_lock (normal operation).
Objecter::rwlock → image_lock: recorded when the EC split-op completion fires and the callback (e.g. luks::LoadRequest::handle_read_header) acquires image_lock.
Lockdep detects the cycle and calls ceph_abort().

This contrasts with the non-split path in handle_osd_op_reply, where the equivalent shared lock sul is explicitly unlocked before complete_op_reply is called (~line 3941 vs ~line 3992).

Fix

Rename "rl" to "sul" to follow code conventions.

Add sul.unlock() after acquiring sl and before calling complete_op_reply on the rc != -EAGAIN branch, matching the established sul.unlock() in handle_osd_op_reply.

sul is still required on the rc == -EAGAIN branch because it is passed by reference to _op_submit, so the unlock is placed only on the non-EAGAIN side of the branch.

The session pointer guard (op->session != splitop_session) is evaluated while sul is held and before sl is acquired, so releasing sul after sl is held does not affect that safety check.

Signed-off-by: Matty Williams [email protected]
Assisted-by: IBM-Bob-2.1.0:Claude/GPT

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.

…plete

Unlock rwlock before user callback to avoid deadlocks where the callback attempts to acquire image_lock.
Rename "rl" to "sul" to follow conventions.

Fixes: https://tracker.ceph.com/issues/80241
Signed-off-by: Matty Williams <[email protected]>
Assisted-by: IBM-Bob-2.1.0:Claude/GPT
@MattyWilliams22
MattyWilliams22 marked this pull request as ready for review September 4, 2026 08:25

@JonBailey1993 JonBailey1993 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.

Looks good to me

@SrinivasaBharath

Copy link
Copy Markdown
Contributor

This PR has been added to wip-bharath10-testing-20260910.230227-main.

@connorfawcett

Copy link
Copy Markdown
Contributor

@MattyWilliams22
MattyWilliams22 merged commit 44aad5b into ceph:main Sep 22, 2026
18 checks passed
@MattyWilliams22
MattyWilliams22 deleted the wip-splitop-rwlock-fix branch September 22, 2026 15:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants