udisks icon indicating copy to clipboard operation
udisks copied to clipboard

Teardown and deactivate across modules

Open tbzatek opened this issue 5 years ago • 0 comments

UDisks provides so-called tear-down option for couple of methods that is supposed to hierarchically walk through the device tree and lock/destroy/cleanup everything involved, including fstab and crypttab records. For this to work the daemon needs to know designated usage of every block device involved. I.e. detect that this is a LUKS, so close it and remove corresponding crypttab record. If it contains a partition table, then recurse across nested partitions. If it's an active MDRAID, then stop it and remove.

This currently fails for objects created and activated by modules as the daemon doesn't understand the logic behind. An example is a PV - deactivated LV - closed LUKS stack and calling teardown on the PV. In such case the crypttab record doesn't get removed as the teardown_block_walker() doesn't understand LVM.

This is not just an issue for teardown functionality, similar hierarchical walker would be needed for a kind of deactivate functionality.


There are several approaches possible. One being an enhancement of each UDisksObject with a list of teardown and deactivate callbacks that the UDisksLinuxBlock teardown walker would call. A list because there might be multiple modules interested in the particular block device. Not sure how this would work e.g. for multidisk volumes.

Or just expose a general udisks_module_teardown() method that would somehow return list of children.

tbzatek avatar Jun 23 '20 15:06 tbzatek