]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
[PATCH] md: make sure mddev->bitmap_offset gets cleared between array instantiations.
authorNeilBrown <neilb@cse.unsw.edu.au>
Thu, 18 Aug 2005 18:24:16 +0000 (11:24 -0700)
committerLinus Torvalds <torvalds@g5.osdl.org>
Thu, 18 Aug 2005 19:53:57 +0000 (12:53 -0700)
... otherwise we might try to load a bitmap from an array which hasn't one.

The bug is that if you create an array with an internal bitmap, shut it down,
and then create an array with the same md device, the md drive will assume it
should have a bitmap too.  As the array can be created with a different md
device, it is mostly an inconvenience.  I'm pretty sure there is no risk of
data corruption.

Signed-off-by: Neil Brown <neilb@cse.unsw.edu.au>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
drivers/md/md.c

index 480f658db6f21f11809216e905c90eb676f76268..d4c275604a3eb8e26753962f63ab3bcf9a9584d3 100644 (file)
@@ -623,6 +623,7 @@ static int super_90_validate(mddev_t *mddev, mdk_rdev_t *rdev)
                mddev->raid_disks = sb->raid_disks;
                mddev->size = sb->size;
                mddev->events = md_event(sb);
+               mddev->bitmap_offset = 0;
 
                if (sb->state & (1<<MD_SB_CLEAN))
                        mddev->recovery_cp = MaxSector;
@@ -938,6 +939,7 @@ static int super_1_validate(mddev_t *mddev, mdk_rdev_t *rdev)
                mddev->raid_disks = le32_to_cpu(sb->raid_disks);
                mddev->size = le64_to_cpu(sb->size)/2;
                mddev->events = le64_to_cpu(sb->events);
+               mddev->bitmap_offset = 0;
                
                mddev->recovery_cp = le64_to_cpu(sb->resync_offset);
                memcpy(mddev->uuid, sb->set_uuid, 16);
@@ -1824,6 +1826,7 @@ static int do_md_stop(mddev_t * mddev, int ro)
                fput(mddev->bitmap_file);
                mddev->bitmap_file = NULL;
        }
+       mddev->bitmap_offset = 0;
 
        /*
         * Free resources if final stop