Some times devices disappear when they are still in use (e.g. mounted, part of an array, LUKS partition that is set-up). This can happen because users yank the device or the device fails. Right now we have some code for dealing with these situations but the code is not very robust and it would probably be best to just leave that task to the kernel where it belongs. This bug is for discussing how to best handle this.
Bug 24708 is related to this.
I talked to Kay about this some time ago and we ended up with something like this First, we can't really make the kernel be super clever about these things; while the status quo is decidedly broken for desktop workloads there are other (server) workloads where this degree of "policy" (e.g. auto-unmounting, auto-teardown) is unwanted. Mostly due to cascading effects, making things harder to debug and, well, the status quo. Second, we want to do the right thing for devices set up via DeviceKit-disks. Third, we want to make it possible for admins for "the right thing" to happen even for devices not set up via DeviceKit-disks. This should be achieved by having a DKD_CLEANUP udev property that admins can set to 1 on a per-device basis. Now, "the right thing" includes 1. force/lazy unmounting filesystems when the device goes away - this includes things mounted via /etc/fstab through FilesystemMount() which we don't do right now (bug 24708) 2. force removal of MD RAID components when the component device goes away 3. force shutdown of a MD RAID array when an insufficient number of components are available 4. ditto for device-mapper - right now only dm-crypt/LUKS use cases are interesting but eventually we want to support LVM2 (bug 24599) 5. ditto for other things
These days udisks handles this by only tearing down stuff (mounts, crypto) set up via udisks and this seems to work fine. Closing.
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.