]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
When updating uuid, update the bitmap as well - external bitmaps
authorNeil Brown <neilb@suse.de>
Tue, 16 May 2006 06:05:27 +0000 (06:05 +0000)
committerNeil Brown <neilb@suse.de>
Tue, 16 May 2006 06:05:27 +0000 (06:05 +0000)
Signed-off-by: Neil Brown <neilb@suse.de>
Assemble.c
ChangeLog
bitmap.c
mdadm.h

index a856456cee8041ecc81d7f00854fce32cfef49c5..897c33f0261762c81fcd7dae133118debd92ff16 100644 (file)
@@ -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)
index a6047ac059fb7fa1131a939f5100f0d531302cc4..fe22413a3affaba6d779f1e625a2d225a87be2ee 100644 (file)
--- 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
index 75492f759fe0c2ad2c8ee7464b556ed2163dc8ae..8210278f356910fda95c9ac741475d8afcd80c17 100644 (file)
--- 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 c53f9e91c44768b730ea1f70c131175b1f65b4c5..70aa1508743ae86ce2683fc527ccfa6917a9f553 100644 (file)
--- 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);