Re: [PATCH v5 0/2] libceph: reject zero bucket types and clean up type 0 uses

Ilya Dryomov <[email protected]> Wed, 22 Jul 2026 22:16:51 +0200
Newsgroups org.kernel.vger.ceph-devel
Message-ID <CAOi1vP_tQV-v9R3=-kdUj26s-0AutxaxaFOJkMLjeVbPuRQbXw@mail.gmail.com>
On Fri, Jun 5, 2026 at 10:43 AM Ren Wei <[email protected]> wrote:
>
> From: Douya Le <[email protected]>
>
> This series fixes a CRUSH map decode issue in libceph and keeps the
> follow-up type-0-to-constant cleanup in a separate patch.
>
> Patch 1/2 rejects bucket type 0 during CRUSH map decode and defines the
> reserved device type in a separate enum.
>
> Patch 2/2 uses that type constant consistently in the CRUSH mapper
> paths that identify leaf devices.
>
> Douya Le (2):
>   libceph: reject zero bucket types in crush_decode
>   libceph: crush: use CRUSH_ITEM_TYPE_DEVICE for leaf device checks
>
>  include/linux/crush/crush.h | 6 +++++-
>  net/ceph/crush/mapper.c     | 8 ++++----
>  net/ceph/osdmap.c           | 2 ++
>  3 files changed, 11 insertions(+), 5 deletions(-)
>
> --
> 2.47.3
>

Hi Ren,

I have staged v1 of this fix (i.e. the version without the new
CRUSH_ITEM_TYPE_DEVICE constant, touching only net/ceph/osdmap.c).
While I don't mind the constant, there was some discussion about its
name, it being in a separate enum, etc which needs to be agreed upon on
the userpace side first.  The implementation of the CRUSH algorithm
(include/linux/crush/* and net/ceph/crush/*) is shared with userspace
and the userspace side is considered to be the reference, so the flow
for changes there is supposed to be userspace -> kernel.

In userspace currently there is no constant and "device" is also
referred to as "leaf" or "osd" in some places, so it's not clear if
CRUSH_ITEM_TYPE_DEVICE is going to stick.

    if (type == 0) {
      // want leaf?
      children->push_back(id);
    }

        if (type == 0) // osd
          break;

Thanks,

                Ilya