aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2008-04-30 03:52:29 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-04-30 11:29:32 -0400
commitd897dbf91490f26dccef3d7056ffd09eb83a15a5 (patch)
treec9e812bf24f39a497d197f516cf3023482403d19 /drivers/md
parent8377bc808029251c2c0f52116cf87d80291b25bf (diff)
md: reinitialise more mddev fields in do_md_stop.
I keep finding problems where an mddev gets reused and some fields has a value from a previous usage that confuses the new usage. So clear all fields that could possible need clearing when calling do_md_stop. Also initialise the 'level' of a new array to LEVEL_NONE (which isn't 0). Signed-off-by: Neil Brown <neilb@suse.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/md')
-rw-r--r--drivers/md/md.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 61767f1962eb..7a44c81ae3cd 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -276,6 +276,7 @@ static mddev_t * mddev_find(dev_t unit)
276 init_waitqueue_head(&new->sb_wait); 276 init_waitqueue_head(&new->sb_wait);
277 new->reshape_position = MaxSector; 277 new->reshape_position = MaxSector;
278 new->resync_max = MaxSector; 278 new->resync_max = MaxSector;
279 new->level = LEVEL_NONE;
279 280
280 new->queue = blk_alloc_queue(GFP_KERNEL); 281 new->queue = blk_alloc_queue(GFP_KERNEL);
281 if (!new->queue) { 282 if (!new->queue) {
@@ -3714,6 +3715,30 @@ static int do_md_stop(mddev_t * mddev, int mode)
3714 mddev->reshape_position = MaxSector; 3715 mddev->reshape_position = MaxSector;
3715 mddev->external = 0; 3716 mddev->external = 0;
3716 mddev->persistent = 0; 3717 mddev->persistent = 0;
3718 mddev->level = LEVEL_NONE;
3719 mddev->clevel[0] = 0;
3720 mddev->flags = 0;
3721 mddev->ro = 0;
3722 mddev->metadata_type[0] = 0;
3723 mddev->chunk_size = 0;
3724 mddev->ctime = mddev->utime = 0;
3725 mddev->layout = 0;
3726 mddev->max_disks = 0;
3727 mddev->events = 0;
3728 mddev->delta_disks = 0;
3729 mddev->new_level = LEVEL_NONE;
3730 mddev->new_layout = 0;
3731 mddev->new_chunk = 0;
3732 mddev->curr_resync = 0;
3733 mddev->resync_mismatches = 0;
3734 mddev->suspend_lo = mddev->suspend_hi = 0;
3735 mddev->sync_speed_min = mddev->sync_speed_max = 0;
3736 mddev->recovery = 0;
3737 mddev->in_sync = 0;
3738 mddev->changed = 0;
3739 mddev->degraded = 0;
3740 mddev->barriers_work = 0;
3741 mddev->safemode = 0;
3717 3742
3718 } else if (mddev->pers) 3743 } else if (mddev->pers)
3719 printk(KERN_INFO "md: %s switched to read-only mode.\n", 3744 printk(KERN_INFO "md: %s switched to read-only mode.\n",