Re: [PATCH] block: don't embed integrity_kobj into gendisk
From: Martin K. Petersen
Date: Thu Mar 09 2023 - 16:20:53 EST
Hi Thomas!
> A struct kobject is only supposed to be embedded into objects which
> lifetime it will manage. Objects of type struct gendisk however are
> refcounted by their part0 block_device. Therefore the integrity_kobj
> should not be embedded but split into its own independently managed
> object.
That's how we originally did it. However, this caused problems for a
couple of subsystems, NVMe and DM, if I remember correctly.
Managing the lifetime of request_queue vs. gendisk vs. blk_integrity
proved to be tricky. Basically at the time things were allocated we
didn't yet have all the information required to complete the block
device setup. We had to be able to send commands to the drive to finish
probing for all the relevant parameters. That dependency was the
rationale behind inlining the blk_integrity into gendisk so it was
always available. Hazy on the details, this was a long time ago.
Another option would be to reshuffle the sysfs bits. The kobj really
isn't used for anything else.
--
Martin K. Petersen Oracle Linux Engineering