diff options
author | Neil Brown <neilb@suse.de> | 2006-04-28 14:10:38 +1000 |
---|---|---|
committer | Neil Brown <neilb@suse.de> | 2006-04-28 14:10:38 +1000 |
commit | c4d831e164da10be75f915f9e06c529e90f55da9 (patch) | |
tree | b3ebaa1dfbd810d7a5d0da1c19601646fdf01511 /super1.c | |
parent | 7fa42a0b5e4541b7178c848229fcb7e98696babe (diff) | |
download | mdadm-c4d831e164da10be75f915f9e06c529e90f55da9.tar.gz mdadm-c4d831e164da10be75f915f9e06c529e90f55da9.tar.xz mdadm-c4d831e164da10be75f915f9e06c529e90f55da9.zip |
[PATCH] Make sure update_super returns correct value.
For 'force' and 'assemble', update_super must return true
if anything was changed.
Also fix a bug with wonly handling in super0.
Signed-off-by: Neil Brown <neilb@suse.de>
### Diffstat output
./super0.c | 18 ++++++++++++++----
./super1.c | 7 +++++++
2 files changed, 21 insertions(+), 4 deletions(-)
diff ./super0.c~current~ ./super0.c
Diffstat (limited to 'super1.c')
-rw-r--r-- | super1.c | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -423,14 +423,21 @@ static void getinfo_super1(struct mdinfo *info, void *sbv) static int update_super1(struct mdinfo *info, void *sbv, char *update, char *devname, int verbose) { + /* NOTE: for 'assemble' and 'force' we need to return non-zero if any change was made. + * For others, the return value is ignored. + */ int rv = 0; struct mdp_superblock_1 *sb = sbv; if (strcmp(update, "force")==0) { + if (sb->events != __cpu_to_le64(info->events)) + rv = 1; sb->events = __cpu_to_le64(info->events); switch(__le32_to_cpu(sb->level)) { case 5: case 4: case 6: /* need to force clean */ + if (sb->resync_offset != ~0ULL) + rv = 1; sb->resync_offset = ~0ULL; } } |