shutdown: don't attempt to detach DM volume backing /usr/

Since we run off /usr/ it makes no sense to attempt to try to detach any
DM device backing it. Hence skip it just like we skip detaching the DM
device backing the root fs.

Addresses: https://github.com/systemd/systemd/issues/27682#issuecomment-1573328188
This commit is contained in:
Lennart Poettering
2023-06-02 15:56:06 +02:00
parent f5fcacdf2c
commit 31d346206c
+5 -2
View File
@@ -121,15 +121,18 @@ static int delete_dm(DeviceMapper *m) {
static int dm_points_list_detach(DeviceMapper **head, bool *changed, bool last_try) {
int n_failed = 0, r;
dev_t rootdev = 0;
dev_t rootdev = 0, usrdev = 0;
assert(head);
assert(changed);
(void) get_block_device("/", &rootdev);
(void) get_block_device("/usr", &usrdev);
LIST_FOREACH(device_mapper, m, *head) {
if (major(rootdev) != 0 && rootdev == m->devnum) {
if ((major(rootdev) != 0 && rootdev == m->devnum) ||
(major(usrdev) != 0 && usrdev == m->devnum)) {
log_debug("Not detaching DM %s that backs the OS itself, skipping.", m->path);
n_failed ++;
continue;
}