summaryrefslogtreecommitdiffstats
path: root/Incremental.c
diff options
context:
space:
mode:
authorSong Liu <songliubraving@fb.com>2017-08-29 18:53:02 +0200
committerJes Sorensen <jsorensen@fb.com>2017-09-01 17:12:16 +0200
commit3b8c7127558bad386c8350e039061107c9cf6cde (patch)
tree2be6900464c1117396b9b483c6acba041715ba11 /Incremental.c
parentmdadm: install two more udev rules in mdadm.spec (diff)
downloadmdadm-3b8c7127558bad386c8350e039061107c9cf6cde.tar.xz
mdadm-3b8c7127558bad386c8350e039061107c9cf6cde.zip
mdadm: set journal_clean after scanning all disks
Summary: In Incremental.c:count_active(), max_events is tracked to show to which devices are up to date. If a device has events==max_events+1, getinfo_super() is called to reload the superblock from this device. getinfo_super1() blindly set journal_clean to 0, which is wrong. This patch fixes this by tracking max_journal_events for all the disks. After scanning all disks, journal_clean is set if max_journal_events >= max_events-1. Signed-off-by: Song Liu <songliubraving@fb.com> Reviewed-by: NeilBrown <neilb@suse.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
Diffstat (limited to 'Incremental.c')
-rw-r--r--Incremental.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/Incremental.c b/Incremental.c
index 6cf21742..91301eb5 100644
--- a/Incremental.c
+++ b/Incremental.c
@@ -684,6 +684,7 @@ static int count_active(struct supertype *st, struct mdinfo *sra,
int cnt = 0;
int replcnt = 0;
__u64 max_events = 0;
+ __u64 max_journal_events = 0;
char *avail = NULL;
int *best = NULL;
char *devmap = NULL;
@@ -714,8 +715,9 @@ static int count_active(struct supertype *st, struct mdinfo *sra,
info.array.raid_disks = raid_disks;
st->ss->getinfo_super(st, &info, devmap + raid_disks * devnum);
- if (info.disk.raid_disk == MD_DISK_ROLE_JOURNAL)
- bestinfo->journal_clean = 1;
+ if (info.disk.raid_disk == MD_DISK_ROLE_JOURNAL &&
+ info.events > max_journal_events)
+ max_journal_events = info.events;
if (!avail) {
raid_disks = info.array.raid_disks;
avail = xcalloc(raid_disks, 1);
@@ -765,6 +767,8 @@ static int count_active(struct supertype *st, struct mdinfo *sra,
replcnt++;
st->ss->free_super(st);
}
+ if (max_journal_events >= max_events - 1)
+ bestinfo->journal_clean = 1;
if (!avail)
return 0;