]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
detach-md: similar to the DM case, also don't try to detach MD device backing /usr/
authorLennart Poettering <lennart@poettering.net>
Fri, 2 Jun 2023 09:41:40 +0000 (11:41 +0200)
committerLennart Poettering <lennart@poettering.net>
Fri, 2 Jun 2023 13:56:06 +0000 (15:56 +0200)
src/shutdown/detach-md.c

index d5188ea822d62c531dcd4693a66ca1e4956c8731..ae592f6f31ddd13236e0a782571b48307c8b3588 100644 (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;
                 }