bd_link_disk_holder(9)
π
bd_link_disk_holder β kernel api manual, bestie edition π
okay so we're in the Kernel API Manual today and this one is genuinely iconic, no cap.
β¨ NAME β¨
bd_link_disk_holder β creates symlinks between the holding disk and the slave bdev π«Ά
like that's literally the whole job. symlinks. between things. slay.
πΈ SYNOPSIS πΈ
int bd_link_disk_holder (struct block_device *bdev , struct gendisk *disk );
π¦ ARGUMENTS π¦
bdevβ the claimed slave bdev. yes bestie, it has to be claimed already, we'll get to that.diskβ the holding disk. the main character in this whole situation π
π₯ DESCRIPTION π₯
DON'T USE THIS UNLESS YOU'RE ALREADY USING IT.
no literally. that's in the manpage. that's not me being dramatic. if you're not already in this ecosystem, back away slowly π
so this function creates the following sysfs symlinks:
- going from the
"slaves"directory of the holder disk β to the claimed bdev - going from the
"holders"directory of the bdev β to the holder disk
like it's giving mutuals. both directions. we love a two-way link π
for example, if /dev/dm-0 maps to /dev/sda and disk for dm-0 is passed to bd_link_disk_holder, then:
/sys/block/dm-0/slaves/sda --> /sys/block/sda
/sys/block/sda/holders/dm-0 --> /sys/block/dm-0
see how they point at each other?? obsessed. π₯Ή
now the rules, and these are NOT optional:
the caller must have claimed bdev before calling this function, and must ensure that both bdev and disk are valid during the creation and lifetime of these symlinks. like not just when you make them β the whole time they exist. if they go away while the symlinks are still vibing, that's on you bestie π
π CONTEXT π
might sleep. π΄
like fr fr, this one can nap. plan accordingly.
β RETURN β
0on success π-errnoon failure π
π§ SEE ALSO π§
- Kernel file
./block/holder.c bd_unlink_disk_holder(9)β the breakup function, iykyk
and that's the page!! π mwah π
kiss kiss, this was brought to you by the ./block crew, October 2026 edition β bd_link_disk_holder(9), logging off πβ¨
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms