1
0
mirror of https://github.com/systemd/systemd.git synced 2024-10-28 20:25:38 +03:00

detach-md: similar to the DM case, also don't try to detach MD device backing /usr/

This commit is contained in:
Lennart Poettering 2023-06-02 11:41:40 +02:00
parent 31d346206c
commit 2067a7ec7f

View File

@ -129,15 +129,18 @@ static int delete_md(RaidDevice *m) {
static int md_points_list_detach(RaidDevice **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(raid_device, 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 MD %s that backs the OS itself, skipping.", m->path);
n_failed ++;
continue;
}