summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeil Brown <neilb@suse.de>2006-05-16 06:05:27 +0000
committerNeil Brown <neilb@suse.de>2006-05-16 06:05:27 +0000
commit8131b493df02ad22c8600f4c99d97003a807e5a7 (patch)
tree36569355b1b93688767a229090c721763c652aa2
parent98b24a2afa11d56a9a93a72736cd080224aa1b50 (diff)
downloadmdadm-8131b493df02ad22c8600f4c99d97003a807e5a7.tar.gz
mdadm-8131b493df02ad22c8600f4c99d97003a807e5a7.tar.xz
mdadm-8131b493df02ad22c8600f4c99d97003a807e5a7.zip
When updating uuid, update the bitmap as well - external bitmaps
Signed-off-by: Neil Brown <neilb@suse.de>
-rw-r--r--Assemble.c4
-rw-r--r--ChangeLog2
-rw-r--r--bitmap.c14
-rw-r--r--mdadm.h1
4 files changed, 21 insertions, 0 deletions
diff --git a/Assemble.c b/Assemble.c
index a856456..897c33f 100644
--- a/Assemble.c
+++ b/Assemble.c
@@ -308,6 +308,10 @@ int Assemble(struct supertype *st, char *mddev, int mdfd,
devname);
if (dfd >= 0)
close(dfd);
+
+ if (strcmp(update, "uuid")==0 &&
+ ident->bitmap_fd)
+ bitmap_update_uuid(ident->bitmap_fd, info.uuid);
}
if (verbose > 0)
diff --git a/ChangeLog b/ChangeLog
index a6047ac..fe22413 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -12,6 +12,8 @@ Changes Prior to this release
mode and auto-flag
- --detail checks if array has been started or not and includes that
in report.
+ - When using --update=uuid on an array with a bitmap, update the
+ bitmap's uuid too.
Changes Prior to 2.4.1 release
- Honour --write-mostly when adding to an array without persistent
diff --git a/bitmap.c b/bitmap.c
index 75492f7..8210278 100644
--- a/bitmap.c
+++ b/bitmap.c
@@ -398,3 +398,17 @@ out:
unlink(filename); /* possibly corrupted, better get rid of it */
return rv;
}
+
+void bitmap_update_uuid(int fd, int *uuid)
+{
+ struct bitmap_super_s bm;
+ lseek(fd, 0, 0);
+ if (read(fd, &bm, sizeof(bm)) != sizeof(bm))
+ return;
+ if (bm.magic != __cpu_to_le32(BITMAP_MAGIC))
+ return;
+ memcpy(bm.uuid, uuid, 16);
+ lseek(fd, 0, 0);
+ write(fd, &bm, sizeof(bm));
+ lseek(fd, 0, 0);
+}
diff --git a/mdadm.h b/mdadm.h
index c53f9e9..70aa150 100644
--- a/mdadm.h
+++ b/mdadm.h
@@ -361,6 +361,7 @@ extern int CreateBitmap(char *filename, int force, char uuid[16],
unsigned long long array_size,
int major);
extern int ExamineBitmap(char *filename, int brief, struct supertype *st);
+extern void bitmap_update_uuid(int fd, int *uuid);
extern int md_get_version(int fd);
extern int get_linux_version(void);