]> git.ipfire.org Git - thirdparty/mdadm.git/blobdiff - managemon.c
Create arrays via metadata-update
[thirdparty/mdadm.git] / managemon.c
index 191721829707d7673c79ec20b4c9419568e24bbd..03de9a89f7ba6784c3642aa15b00894372f5dffe 100644 (file)
@@ -428,9 +428,25 @@ void manage(struct mdstat_ent *mdstat, struct supertype *container)
        }
 }
 
-static int handle_message(struct supertype *container, struct metadata_update *msg)
+static void handle_message(struct supertype *container, struct metadata_update *msg)
 {
-       return -1;
+       /* queue this metadata update through to the monitor */
+
+       struct metadata_update *mu;
+
+       if (msg->len == 0) {
+               wait_update_handled();
+       } else {
+               mu = malloc(sizeof(*mu));
+               mu->len = msg->len;
+               mu->buf = msg->buf;
+               msg->buf = NULL;
+               mu->space = NULL;
+               mu->next = NULL;
+               if (container->ss->prepare_update)
+                       container->ss->prepare_update(container, mu);
+               queue_metadata_update(mu);
+       }
 }
 
 void read_sock(struct supertype *container)
@@ -460,8 +476,6 @@ void read_sock(struct supertype *container)
                } else
                        terminate = 1;
 
-               if (msg.buf)
-                       free(msg.buf);
        } while (!terminate);
 
        close(fd);