]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
Reverse order of arrays when --stop --scan
authorNeil Brown <neilb@suse.de>
Mon, 4 Apr 2005 05:16:24 +0000 (05:16 +0000)
committerNeil Brown <neilb@suse.de>
Mon, 4 Apr 2005 05:16:24 +0000 (05:16 +0000)
so that stacked arrays are stopped properly.
Signed-off-by: Neil Brown <neilb@cse.unsw.edu.au>
ChangeLog
mdadm.c

index 8a28181598f40530b2d03638e35898d02b5f9152..9047116c22a9596bb2ae73b1fb19f0bf1951e2c1 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -13,6 +13,8 @@ Changes Prior to 1.9.0 release
     -   Add some missing closes of open file descriptors.
     -   Reread /proc/partition for every array assembled when using
        it to find devices, rather than only once.
+    -   Make "mdadm -Ss" stop stacked devices properly, by reversing the
+       order in which arrays are stopped.
 
 Changes Prior to 1.8.0 release
     -   Makefile cleanup from  Luca Berra <bluca@comedia.it>
diff --git a/mdadm.c b/mdadm.c
index 79f28860d2b636a60e5d21360527013a1e9eefb6..798d6386c6df05530593d34dcc721fd692d8f93e 100644 (file)
--- a/mdadm.c
+++ b/mdadm.c
@@ -793,6 +793,16 @@ int main(int argc, char *argv[])
                                        /* apply to all devices in /proc/mdstat */
                                        struct mdstat_ent *ms = mdstat_read(0);
                                        struct mdstat_ent *e;
+                                       if (devmode == 'S') {
+                                               /* reverse order so that arrays made of arrays are stopped properly */
+                                               struct mdstat_ent *sm = NULL;
+                                               while ((e=ms) != NULL) {
+                                                       ms = e->next;
+                                                       e->next = sm;
+                                                       sm = e;
+                                               }
+                                               ms = sm;
+                                       }
                                        for (e=ms ; e ; e=e->next) {
                                                char *name = get_md_name(e->devnum);