Skip to content

bdev_ec: add bdev_ec_fail_base_bdev RPC - #97

Draft
c3y1huang wants to merge 8 commits into
longhorn:longhorn-v26.05from
c3y1huang:13827-reduce-v2-sharding-stack-overhead
Draft

c3y1huang wants to merge 8 commits into
longhorn:longhorn-v26.05from
c3y1huang:13827-reduce-v2-sharding-stack-overhead

Conversation

@c3y1huang

Copy link
Copy Markdown

Which issue(s) this PR fixes:

Issue longhorn/longhorn#13827

What this PR does / why we need it:

Before this change, a disk in an EC bdev only became FAILED when SPDK saw it gone. Longhorn had no way to fail a disk it knew was bad but still attached.

This adds a bdev_ec_fail_base_bdev RPC that moves a NORMAL slot to FAILED.

  1. New RPC: Longhorn can now tell the EC bdev to fail on demand.
  2. Replace wait for cleanup: When a disk fails, its descriptor is still open while the cleanup chain tears it down. Replacing the disk during that window leaked the old descriptor and pointed the cleanup's reset at the new disk. Replace now returns -EBUSY until cleanup is done.
  3. Add cleanup_pending in bdev_ec_get_bdevs: Tells Longhorn why replace returned busy and when to retry.

Special notes for your reviewer:

None

Additional documentation or context

longhorn/longhorn#14586

@c3y1huang c3y1huang self-assigned this Nov 19, 2026
@c3y1huang
c3y1huang force-pushed the 13827-reduce-v2-sharding-stack-overhead branch 2 times, most recently from 2995700 to 8947836 Compare November 19, 2026 04:47
@c3y1huang
c3y1huang requested a balanced review from Copilot November 19, 2026 04:47

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

Critical cleanup and failure-transition races can corrupt parity, free descriptors still used by outstanding I/O, and leave device-wide I/O blocked indefinitely.

4 open issues
What changed in this PR

Adds bdev_ec_fail_base_bdev so Longhorn can mark an attached EC disk as failed without waiting for device removal.

Changes:

  • Exposes the failure operation through the RPC handler, schema, Python client, and CLI.
  • Blocks replacement while cleanup holds the old descriptor and reports cleanup_pending.
  • Shares failure handling with device-removal events and adds unit coverage.
File Description
test/​unit/​lib/​bdev/​ec/​bdev_ec.c/​bdev_ec_ut.c Tests failure requests, replacement blocking, and cleanup status.
schema/​schema.json Defines the new RPC parameters.
python/​spdk/​rpc/​bdev.py Adds the Python RPC wrapper.
python/​spdk/​cli/​bdev.py Adds the CLI command.
module/​bdev/​ec/​bdev_ec.h Declares and documents the failure API.
module/​bdev/​ec/​bdev_ec.c Implements explicit failure, shared cleanup, replacement guarding, and status reporting.
module/​bdev/​ec/​bdev_ec_rpc.c Handles failure requests and returns slot cleanup status.

Review effort: Balanced

Comment thread module/bdev/ec/bdev_ec.c Resolved
Comment thread module/bdev/ec/bdev_ec.c Resolved
Comment thread module/bdev/ec/bdev_ec.c Resolved
Comment thread module/bdev/ec/bdev_ec.c Resolved
@c3y1huang
c3y1huang force-pushed the 13827-reduce-v2-sharding-stack-overhead branch from 8947836 to 502f868 Compare November 19, 2026 06:53
@c3y1huang
c3y1huang requested a balanced review from Copilot November 19, 2026 06:54

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

The replace RPC still reports pending slot cleanup as an in-progress replacement, misleading callers and omitting guidance to check cleanup_pending in bdev_ec_get_bdevs before retrying.

2 open issues
3 resolved since last review

Review effort: Balanced

Comment thread module/bdev/ec/bdev_ec.c Resolved
@c3y1huang
c3y1huang force-pushed the 13827-reduce-v2-sharding-stack-overhead branch from 502f868 to 484b77b Compare November 19, 2026 08:52
@c3y1huang
c3y1huang requested a balanced review from Copilot November 19, 2026 08:52

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔵 Needs a closer look

The EC integrity and descriptor-lifecycle changes need runtime validation of fail/cleanup/replace during concurrent foreground I/O and resize, because the unit tests stub quiesce and omit the asynchronous cleanup/channel-walk sequence.

No open issues 🎉

2 resolved since last review

Review effort: Balanced

c3y1huang and others added 8 commits November 20, 2026 11:26
longhorn/longhorn-13827

Signed-off-by: Chin-Ya Huang <chin-ya.huang@suse.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
longhorn/longhorn-13827

Signed-off-by: Chin-Ya Huang <chin-ya.huang@suse.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
longhorn/longhorn-13827

Signed-off-by: Chin-Ya Huang <chin-ya.huang@suse.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
longhorn/longhorn-13827

Signed-off-by: Chin-Ya Huang <chin-ya.huang@suse.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
longhorn/longhorn-13827

Signed-off-by: Chin-Ya Huang <chin-ya.huang@suse.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
longhorn/longhorn-13827

Signed-off-by: Chin-Ya Huang <chin-ya.huang@suse.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
longhorn/longhorn-13827

Signed-off-by: Chin-Ya Huang <chin-ya.huang@suse.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
longhorn/longhorn-13827

Signed-off-by: Chin-Ya Huang <chin-ya.huang@suse.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants