]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
Make sure resync_start is initialised properly and maintained properly
authorNeil Brown <neilb@suse.de>
Fri, 18 Jul 2008 06:37:04 +0000 (16:37 +1000)
committerNeil Brown <neilb@suse.de>
Fri, 18 Jul 2008 06:37:04 +0000 (16:37 +1000)
Signed-off-by: Neil Brown <neilb@suse.de>
Create.c
managemon.c
mdmon.h
monitor.c
super-ddf.c

index c51b7eb04ddd7e83d0f8a8f4d3590f3b6a85ed3c..b2edc7d6e7bcada0514854cc498fe105865f9ec9 100644 (file)
--- a/Create.c
+++ b/Create.c
@@ -448,11 +448,13 @@ int Create(struct supertype *st, char *mddev, int mdfd,
             ( level <= 0 )
             ||
             assume_clean
-               )
+               ) {
                info.array.state = 1; /* clean, but one+ drive will be missing*/
-       else
+               info.resync_start = ~0ULL;
+       } else {
                info.array.state = 0; /* not clean, but no errors */
-
+               info.resync_start = 0;
+       }
        if (level == 10) {
                /* for raid10, the bitmap size is the capacity of the array,
                 * which is array.size * raid_disks / ncopies;
index 94fbcb2ce67c519b212de1685a286c943cfff691..447d8ea0001f19e51cbf7e6291b71783aff42a5f 100644 (file)
@@ -379,7 +379,7 @@ static void manage_new(struct mdstat_ent *mdstat,
        new->action_fd = sysfs_open(new->devnum, NULL, "sync_action");
        new->info.state_fd = sysfs_open(new->devnum, NULL, "array_state");
        new->resync_start_fd = sysfs_open(new->devnum, NULL, "resync_start");
-       new->resync_start = 0;
+       get_resync_start(new);
        dprintf("%s: inst: %d action: %d state: %d\n", __func__, atoi(inst),
                new->action_fd, new->info.state_fd);
 
diff --git a/mdmon.h b/mdmon.h
index 02cdb09423cec1b613634c764cb4e8860a5e3133..a1f0379b83c08ee2fd8e305b1ed9d57afb54b51c 100644 (file)
--- a/mdmon.h
+++ b/mdmon.h
@@ -56,6 +56,7 @@ void do_monitor(struct supertype *container);
 void do_manager(struct supertype *container);
 
 int read_dev_state(int fd);
+int get_resync_start(struct active_array *a);
 
 struct mdstat_ent *mdstat_read(int hold, int start);
 
index d6b1fbe1dda55ae84e7a8a4e36af2f6c1bbdd669..314889657aaae88629241ab4ae69d80b4832284a 100644 (file)
--- a/monitor.c
+++ b/monitor.c
@@ -48,7 +48,7 @@ static int read_attr(char *buf, int len, int fd)
 }
 
 
-static int get_resync_start(struct active_array *a)
+int get_resync_start(struct active_array *a)
 {
        char buf[30];
        int n;
index cb7f67c4fdeb9e00a12c4dee2b6109c9193fed76..5d38750489193302e6a4bcd0e56809ccdc29957b 100644 (file)
@@ -1286,6 +1286,8 @@ static void getinfo_super_ddf_bvd(struct supertype *st, struct mdinfo *info)
 //     info->disk.raid_disk = find refnum in the table and use index;
 //     info->disk.state = ???;
 
+       info->container_member = ddf->currentconf->vcnum;
+
        info->resync_start = 0;
        if (!(ddf->virt->entries[info->container_member].state
              & DDF_state_inconsistent)  &&