提交 9223214e 编写于 作者: N NeilBrown 提交者: Linus Torvalds

[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: NNeil Brown <neilb@cse.unsw.edu.au>
Signed-off-by: NAndrew Morton <akpm@osdl.org>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 60d7603a
......@@ -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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册