aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md
diff options
context:
space:
mode:
authorNeilBrown <neilb@cse.unsw.edu.au>2005-08-18 14:24:16 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2005-08-18 15:53:57 -0400
commit9223214e8d757663f366133ba5f9b58aa6b28efb (patch)
treeb3977e067dbf3b2679c16f77c9e9025c7f71f26f /drivers/md
parent60d7603a18a5c07252e7aa0b0e2424315195d4dc (diff)
[PATCH] md: make sure mddev->bitmap_offset gets cleared between array instantiations.
... 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>
Diffstat (limited to 'drivers/md')
-rw-r--r--drivers/md/md.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 480f658db6f2..d4c275604a3e 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -623,6 +623,7 @@ static int super_90_validate(mddev_t *mddev, mdk_rdev_t *rdev)
623 mddev->raid_disks = sb->raid_disks; 623 mddev->raid_disks = sb->raid_disks;
624 mddev->size = sb->size; 624 mddev->size = sb->size;
625 mddev->events = md_event(sb); 625 mddev->events = md_event(sb);
626 mddev->bitmap_offset = 0;
626 627
627 if (sb->state & (1<<MD_SB_CLEAN)) 628 if (sb->state & (1<<MD_SB_CLEAN))
628 mddev->recovery_cp = MaxSector; 629 mddev->recovery_cp = MaxSector;
@@ -938,6 +939,7 @@ static int super_1_validate(mddev_t *mddev, mdk_rdev_t *rdev)
938 mddev->raid_disks = le32_to_cpu(sb->raid_disks); 939 mddev->raid_disks = le32_to_cpu(sb->raid_disks);
939 mddev->size = le64_to_cpu(sb->size)/2; 940 mddev->size = le64_to_cpu(sb->size)/2;
940 mddev->events = le64_to_cpu(sb->events); 941 mddev->events = le64_to_cpu(sb->events);
942 mddev->bitmap_offset = 0;
941 943
942 mddev->recovery_cp = le64_to_cpu(sb->resync_offset); 944 mddev->recovery_cp = le64_to_cpu(sb->resync_offset);
943 memcpy(mddev->uuid, sb->set_uuid, 16); 945 memcpy(mddev->uuid, sb->set_uuid, 16);
@@ -1824,6 +1826,7 @@ static int do_md_stop(mddev_t * mddev, int ro)
1824 fput(mddev->bitmap_file); 1826 fput(mddev->bitmap_file);
1825 mddev->bitmap_file = NULL; 1827 mddev->bitmap_file = NULL;
1826 } 1828 }
1829 mddev->bitmap_offset = 0;
1827 1830
1828 /* 1831 /*
1829 * Free resources if final stop 1832 * Free resources if final stop