Project

General

Profile

Actions

Bug #80441

open
DP

ceph-volume activate probes every block device (including /dev/rbdN) with show-label before trying LVM; it hangs in D state when that RBD's PGs are inactive, deadlocking OSD start on hosts with krbd mappings

Bug #80441: ceph-volume activate probes every block device (including /dev/rbdN) with show-label before trying LVM; it hangs in D state when that RBD's PGs are inactive, deadlocking OSD start on hosts with krbd mappings

Added by David Pérez Ruiz 3 months ago.

Status:
New
Priority:
Normal
Assignee:
-
Target version:
-
Due date:
% Done:

0%

Source:
Backport:
Regression:
No
Severity:
2 - major
Reviewed:
Affected Versions:
ceph-qa-suite:
Pull request ID:
Tags (freeform):
Merge Commit:
Fixed In:
Released In:
Upkeep Timestamp:

Description

Summary

ceph-volume activate --osd-id N --osd-uuid U always tries the raw backend first, even for an LVM OSD. With no devices given, the raw list runs a single ceph-bluestore-tool show-label over every block device reported by lsblk, and that includes kernel RBD devices (/dev/rbdN) and /dev/nbdN.

On a host where RBD images of the same cluster are mapped (hyperconverged Kubernetes with ceph-csi/krbd), a read of /dev/rbdN blocks in uninterruptible sleep while the PGs behind that image are inactive. If the OSD being activated is needed to make those PGs active, activation never finishes: a deadlock that cannot be killed. It only clears if the PGs become active by other means.

Environment

  • Ceph 19.2.6 (quay.io/ceph/ceph@sha256:ff836bb28e7d0be0ec4dd22e79407174452a96e11ee62e9cdd1fa47f4bcc3bdc), cephadm, docker 27.5.1
  • Ubuntu 22.04, kernel 5.15.0-133 and 5.15.0-140
  • 3 hosts, 6 LVM BlueStore OSDs, replicated pools size 3 / min_size 2
  • Two of the hosts run k3s with ceph-csi RBD volumes (6 and 8 krbd devices mapped)
  • The cephadm unit.run calls ceph-volume activate --osd-id N --osd-uuid U --no-systemd --no-tmpfs before starting ceph-osd

What happened

Several OSDs on two hosts were restarted in quick succession by cephadm (separate issue, linked below), and PGs became inactive. On both krbd hosts the osd-N-activate containers stayed up for more than 15 minutes, and ceph-osd was never started. The container log stopped after:

Running command: /usr/bin/ceph-authtool --gen-print-key
Running command: /usr/bin/ceph-authtool --gen-print-key

ceph-volume.log:

[ceph_volume.devices.raw.list][DEBUG ] inspecting devices: ['/dev/loop0', ..., '/dev/sda', ..., '/dev/rbd0', '/dev/rbd3', ..., '/dev/nbd0', ...]
[ceph_volume.process][INFO  ] Running command: /usr/bin/ceph-bluestore-tool show-label --bdev_aio_poll_ms=1 --dev /dev/loop0 --dev /dev/loop1 ...

Process state inside the activate container, kernel stack and open block device:

PID      STAT  WCHAN            COMMAND
3860077  S     pipe_read        /usr/bin/python3 -s /usr/sbin/ceph-volume activate --osd-id 2 --osd-uuid ... --no-systemd --no-tmpfs
3860098  Dl    blk_io_schedule  /usr/bin/ceph-bluestore-tool show-label --bdev_aio_poll_ms=1 --dev /dev/loop0 ...

# cat /proc/3860098/stack
blk_io_schedule+0x22/0x40
__blkdev_direct_IO_simple+0x222/0x320
blkdev_direct_IO+0x71/0x80
generic_file_read_iter+0x9c/0x150
blkdev_read_iter+0x4a/0x60
new_sync_read+0x10d/0x190
vfs_read+0x106/0x1a0
__x64_sys_pread64+0x96/0xc0

# ls -l /proc/3860098/fd  -> /dev/rbd0

The third host, which has no krbd mappings, activated its OSDs normally.

Code path (v19.2.6, unchanged in main)

  1. ceph_volume/activate/main.py tries RAWActivate(self.args).activate() first and falls back to LVM only if that raises.
  2. RawBlueStore.activate() calls direct_report(self.devices) with self.devices = None. The --osd-id / --osd-uuid filter is applied only after all devices have been scanned.
  3. devices/raw/list.py List.generate() uses disk.lsblk_all() and only excludes non-existent paths, "Atari" child partitions and LVs tagged as Ceph OSDs. No device type is filtered (rbd, nbd, loop, drbd...). All remaining devices are then passed to a single ceph-bluestore-tool show-label --dev ... --dev ... call.

Recovery used

The OSD data dirs were already primed (block symlink, keyring, fsid, whoami, ready) because of --no-tmpfs. We started ceph-osd manually with the second docker run line of unit.run (with -d, same container name), bypassing activate. Once enough OSDs were up, the PGs peered, the /dev/rbd0 read returned, the stuck activations completed, and unit.run replaced the manually started containers.

Related

cephadm issue: every reconfig of an OSD restarts it because of a keyring text mismatch. That is what triggered the simultaneous OSD restarts here.
https://tracker.ceph.com/issues/80440

No data to display

Actions

Also available in: PDF Atom