From: Lennart Poettering Date: Fri, 2 Jun 2023 09:41:40 +0000 (+0200) Subject: detach-md: similar to the DM case, also don't try to detach MD device backing /usr/ X-Git-Tag: v254-rc1~299^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2067a7ec7f4c8a353b8e2ece15a6a997e50808b0;p=thirdparty%2Fsystemd.git detach-md: similar to the DM case, also don't try to detach MD device backing /usr/ --- diff --git a/src/shutdown/detach-md.c b/src/shutdown/detach-md.c index d5188ea822d..ae592f6f31d 100644 --- a/src/shutdown/detach-md.c +++ b/src/shutdown/detach-md.c @@ -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; }