Raw-mode OSD activate deadlocks on nodes with hung krbd devices: ceph-volume raw activate runs lvs (Ceph >= v20.2.3), rbd LVM filter is only applied in lvm mode
Is this a bug report or feature request?
- Bug Report
Deviation from expected behavior:
On a hyperconverged cluster (the OSD nodes also mount Ceph RBD and CephFS volumes through the kernel client), raw-mode OSDs could not start again after all of them were restarted at the same time. Every new OSD pod stayed in Init:0/4. The activate init container hung forever in ceph-volume raw activate, which runs lvs, and lvs was blocked in uninterruptible sleep (D state) reading a /dev/rbd* device. The RBD device's dirty pages could not be written back because the OSDs were down, so the OSDs and the RBD devices were each waiting on the other. It did not resolve by itself. The rook-ceph-osd-prepare-* pods hung the same way: ceph-volume --log-path /tmp/ceph-log lvm list --format json started at 09:18:41 UTC and only returned at 10:12:38 UTC, after the OSDs had been brought back (see workaround).
Rook already guards against exactly this for lvm-mode OSDs. In pkg/operator/ceph/cluster/osd/activate-osd.sh (same code inline in v1.20.7 spec.go):
if [[ "$CV_MODE" == "lvm" ]]; then
...
# prevent LVM from trying to scan RBD volumes that may be unable to serve reads without this OSD up
echo 'devices { filter = ["r|/dev/rbd.*|"] }' >> /etc/lvm/lvm.confThe raw branch does not get this filter. Its own device scan already skips rbd|nbd|zram|drbd, with a comment about the same deadlock. But it then calls ceph-volume raw activate --device "$DEVICE" --no-systemd --no-tmpfs, and since Ceph v20.2.3 that runs lvs over every block device. The lvs call comes from ceph/ceph cce35ca664 (the tentacle backport of 71a5a6f3fb, "ceph-volume: raw activate should ignore lvm backed OSD devices", https://tracker.ceph.com/issues/76305). It added ceph_volume_lvm_prepare_lv_paths() → get_lvs() at the top of RawBlueStore.activate(). It is in v20.2.3 and v20.2.4, not in v20.2.2. Before that, raw activate did not run LVM, so the raw branch didn't need the filter.
A second, related path: RawBlueStore.activate() also builds CephLuks2(device) for every device in disk.lsblk_all(). That reads the first bytes of each device (_dd_read, a buffered open().read()), rbd devices included. We did not see this one hang, because we bypassed raw activate before reaching it (see workaround). A buffered read of a page that isn't in the page cache would still have to go to the down OSDs, so the LVM filter alone may not be a complete fix.
Expected behavior:
Raw-mode OSDs should start regardless of the state of kernel RBD/CephFS clients on the same node, the same as lvm-mode OSDs. Activation should touch only the OSD's own device(s).
How to reproduce it (minimal and precise):
- Rook v1.20.7, Ceph v20.2.4, raw-mode OSDs (
deviceFilterpartitions, no LVM), hyperconverged: workloads on the OSD nodes use RBD (ext4) PVCs. - Stop all OSDs at once while RBD volumes on those nodes have writes in flight. In our case the nodes were cut off from the API by a network fault longer than the default 300 s
node.kubernetes.io/unreachable:NoExecutetoleration. All OSD pods were evicted, and the kubelets killed them when they reconnected. - The replacement OSD pods hang in
activate. On every OSD node there are D-statelvsprocesses whose parent is theceph-volume raw activatein theactivatecontainer. Each one holds an rbd device that has writes in flight. Node A:
# ls -l /proc/1727783/fd | grep /dev/ # lvs, parent: ceph-volume (activate container)
... -> /dev/mapper/control
... -> /dev/rbd6
# cat /sys/block/rbd6/inflight
0 5Node B, another stuck lvs with its kernel stack:
# ps -o pid,etimes,stat,wchan:30,args --ppid <ceph-volume raw activate pid>
3313490 1105 D folio_wait_bit_common lvs --noheadings --readonly --separator=";" -a --units=b --nosuffix -S -o lv_tags,lv_path,lv_name,vg_name,lv_uuid,lv_size
# cat /proc/3313490/stack
[<0>] folio_wait_bit_common+0x136/0x340
[<0>] folio_wait_bit+0x18/0x30
[<0>] folio_wait_writeback+0x40/0xb0
[<0>] __filemap_fdatawait_range+0x8f/0x100
[<0>] filemap_write_and_wait_range.part.0+0xd8/0x150
[<0>] kiocb_write_and_wait+0x2f/0x80
[<0>] blkdev_read_iter+0xc2/0x190
[<0>] aio_read+0x132/0x230
[<0>] __io_submit_one.isra.0+0xad/0x200
[<0>] io_submit_one+0xef/0x3b0
[<0>] __x64_sys_io_submit+0x90/0x1f0LVM opens each device with O_DIRECT. For a block device, an O_DIRECT read first waits for writeback of dirty page-cache pages in that range, and that writeback is waiting for the down OSDs. The krbd mapping has no osd_request_timeout, so the wait never ends.
The activate container log stops here:
+ ceph-volume raw activate --device /dev/nvme1n1p6 --no-systemd --no-tmpfs
Running command: /usr/bin/ceph-authtool --gen-print-key
Running command: /usr/bin/ceph-authtool --gen-print-keyInside the same stuck activate container, lvs with the lvm-mode filter returns at once:
# lvs --readonly --config 'devices { filter = ["r|/dev/rbd.*|"] }' --noheadings -a -o lv_path,vg_name
/dev/vg0/root vg0Workaround we used (no data loss):
We patched the OSD deployments' activate script, replacing ceph-volume raw activate ... with the steps of RawBlueStore._activate() for a plain OSD (no dmcrypt, no db/wal), so only the OSD's own device is touched:
rm -f "$OSD_DATA_DIR"/block "$OSD_DATA_DIR"/block.db "$OSD_DATA_DIR"/block.wal
chown -R ceph:ceph "$OSD_DATA_DIR"
ceph-bluestore-tool prime-osd-dir --path "$OSD_DATA_DIR" --no-mon-config --dev "$DEVICE"
chown -R ceph:ceph "$DEVICE"
ln -s "$DEVICE" "$OSD_DATA_DIR"/block
chown -R ceph:ceph "$OSD_DATA_DIR"The operator was scaled to 0 and the old (stuck) pods were force-deleted, because the deployments use Recreate. The patched OSDs started in about a minute. Once two hosts' OSDs were up, the PGs went active, the kernel clients' queued writes completed, and every D-state process woke up, including the unpatched OSDs' own lvs. Those OSDs then finished activating by themselves.
Force-unmapping the RBD devices is not an alternative: do_rbd_remove() with force calls blk_mq_freeze_queue(), which waits for the in-flight requests and so hangs as well. Rebooting the node works but throws away the unflushed writes.
Suggested fix:
- Apply the rbd LVM filter in raw mode too, and in the osd-prepare job, which hung in
ceph-volume lvm list. For exampledevices { global_filter = [ "r|^/dev/rbd|", "r|^/dev/nbd|", "r|^/dev/drbd|" ] }, matching the devices the raw scan already skips. - Consider how activation can avoid probing unrelated devices altogether (the
lsblk_all()LUKS2/TPM2 loop above). That may need a ceph-volume change, for example skipping network block devices or only probing when encryption/TPM2 is configured. Happy to raise that on the Ceph tracker if that's the better place.
File(s) to submit:
Relevant CephCluster storage spec:
storage:
useAllNodes: true
useAllDevices: true
deviceFilter: "^(sd[ab]6|nvme[01]n1p6)$"Cluster Status to submit:
While deadlocked: no ceph-osd process on any node and all OSD pods in Init:0/4. ceph -s still showed the OSDs up until the mons marked them down after no beacon for 900 seconds. 169 pgs unknown, 1 MDSs report slow metadata IOs. After the workaround: 169/169 active+clean, with only unrelated, already-known warnings left.
Environment:
- OS (e.g. from /etc/os-release): Ubuntu 26.04.1 LTS (lvm2 2.03.31-2ubuntu3 on the host; LVM 2.03.33 in the
quay.io/ceph/ceph:v20.2.4image) - Kernel (e.g.
uname -a): 7.0.0-31-generic - Cloud provider or hardware configuration: bare-metal servers, OSDs on NVMe partitions, hyperconverged (the same nodes run workloads with krbd/kcephfs mounts)
- Rook version (use
rook versioninside of a Rook Pod): v1.20.7 (raw-mode code path unchanged on master as of 2026-10-01) - Storage backend version (e.g. for ceph do
ceph -v): 20.2.4 (tentacle) - Kubernetes version (use
kubectl version): v1.35.0 - Kubernetes cluster type (e.g. Tectonic, GKE, OpenShift): kubeadm via Cluster API
- Storage backend status: recovered, see above
Source: rook/rook