Skip to content

WAL/DB cleanup: partx -d fails with "error deleting partition 1" while the kernel entry still exists #907

Open

Description

@johnramsden

Issue report

Title: WAL/DB cleanup: partx -d fails with "error deleting partition 1" while the kernel entry still exists

What version of MicroCeph are you using ?

CI builds of main; the earliest failures examined here are at b8f8772 (2026-08-03) and again at 496197b (2026-08-17). The code is the same at 5df62e1, and on squid at f9e5a87, which already has the backport #857.

What are the steps to reproduce this issue ?

  1. Add two OSDs whose generated WAL and DB partitions sit on the same carrier disks (microceph disk add ... --wal-match ... --wal-size 1GiB --db-match ... --db-size 2GiB).
  2. Run microceph disk remove <first-osd-id> --bypass-safety-checks. This is case rm2 of the DSL cleanup test; it is intermittent, and in every failing job rm1 and rmr in the same run pass.

What happens (observed behaviour) ?

The removal fails with failed to clean generated WAL/DB partitions for osd.1: failed to remove kernel partition entry 1 on ...: Failed to run: partx -d --nr 1:1 ...: exit status 1 (partx: ...: error deleting partition 1). That message is returned only when partx -d failed and the partition still resolves afterwards, so the kernel entry was still there. The "already removed" handling of #750 and #857 does not apply. It also means this is not the race described in #835 (sfdisk had already dropped the entry): util-linux partx treats ENXIO as success, so the failure was another errno. EBUSY is the likely one, with an opener such as udev probing the carrier after the zap and sfdisk writes. This is inferred: partx prints no strerror and the logs of the failing jobs contain no daemon journal. Rm2 is the only case hit, probably because the sibling partition is held open by the second, running OSD, so that sfdisk's re-read cannot refresh the kernel table and partx -d is the only remover, with no retry (inferred).

Rate: about 2.6% of cleanup runs (9 of 343). Both main failures ran after #750 merged on main, and one squid run failed after the backport, so the existing handling does not prevent it. Five jobs on the RGW stack (#881 to #893) hit it at 5/188 (2.7%), the same rate as non-stack branches (4/155, 2.6%), and the stack changes none of the code involved.

What were you expecting to happen ?

Removing one of two OSDs that share a carrier succeeds even if something briefly holds the partition open.

Relevant logs, error output, etc.

Additional comments.

#857 left --no-reread and skipping partx as a separate follow-up on both branches, and #835 was closed without it.

Proposed fix in deletePartition, on main and squid:

  1. Pass --no-reread to sfdisk --delete, so partx is the only actor on the kernel table.
  2. Retry partx -d with a short backoff (for example 5 x 200 ms) while the partition still resolves; poll rather than rely on udevadm settle, whose availability under strict confinement was not checked.
  3. After the retries, fall back to a re-read (partx -u or blockdev --rereadpt) and re-check that the partition is gone before returning an error.
  4. Only run partx when the kernel entry exists, and make a re-run of microceph disk remove skip sfdisk if the GPT entry is already gone (inferred that a re-run fails at the sfdisk step today; not exercised in CI).
  5. Add a unit test next to TestDeletePartitionTreatsAlreadyRemovedKernelEntryAsCleaned where partx fails twice with EBUSY and then succeeds.

On the test side, collect snap logs microceph.daemon and the partx and sfdisk output when "first OSD remove should succeed" fails, so the errno becomes observable.

Activity

  1. syncronize-issues-to-jira commented on Oct 2, 2026

    @syncronize-issues-to-jira

    Thank you for reporting your feedback to us!

    The internal ticket has been created: https://warthogs.atlassian.net/browse/CEPH-2075.

    This message was autogenerated

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    CIGitHub CI-related issues

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions