core/mount: make device deps from /proc/self/mountinfo and .mount unit file exclusive
authorYu Watanabe <watanabe.yu+github@gmail.com>
Sat, 14 May 2022 21:31:17 +0000 (06:31 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 4 Aug 2022 16:35:38 +0000 (01:35 +0900)
commit49267b1b147047c294e882b7ae741f8732d36d05
tree1a89d5e10475b43086627159be3f63219bcf4982
parent0fe06168b319064a84fca05109ac3eaaeea499c2
core/mount: make device deps from /proc/self/mountinfo and .mount unit file exclusive

Before this commit, when a .mount unit file is loaded, the device
dependencies from the unit file are automatically added. If a device
that is different from which specified in .mount unit file is mounted
on the path, then the device dependencies about the device are also added.
Hence, the unit has device dependencies about two (or more) different
devices. Hence, if one of the devices are unplugged, even if another one
is mounted on the path, then the path is unmounted.

This commit makes device dependencies from two different sources
exclusive, and always regenerate the dependencies when one of the
information is updated.

Fixes #19983 and #23552.
src/core/mount.c
src/core/unit-serialize.c
src/core/unit.h