so that stacked arrays are stopped properly.
Signed-off-by: Neil Brown <neilb@cse.unsw.edu.au>
- 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>
/* 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);