Commit 0d4ca600 authored by NeilBrown's avatar NeilBrown Committed by Linus Torvalds

[PATCH] md: tidy up device-change notification when an md array is stopped

An md array can be stopped leaving all the setting still in place, or it can
torn down and destroyed.  set_capacity and other change notifications only
happen in the latter case, but should happen in both.
Signed-off-by: default avatarNeil Brown <neilb@suse.de>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent a3d89983
...@@ -3314,6 +3314,10 @@ static int do_md_stop(mddev_t * mddev, int mode) ...@@ -3314,6 +3314,10 @@ static int do_md_stop(mddev_t * mddev, int mode)
module_put(mddev->pers->owner); module_put(mddev->pers->owner);
mddev->pers = NULL; mddev->pers = NULL;
set_capacity(disk, 0);
mddev->changed = 1;
if (mddev->ro) if (mddev->ro)
mddev->ro = 0; mddev->ro = 0;
} }
...@@ -3333,7 +3337,7 @@ static int do_md_stop(mddev_t * mddev, int mode) ...@@ -3333,7 +3337,7 @@ static int do_md_stop(mddev_t * mddev, int mode)
if (mode == 0) { if (mode == 0) {
mdk_rdev_t *rdev; mdk_rdev_t *rdev;
struct list_head *tmp; struct list_head *tmp;
struct gendisk *disk;
printk(KERN_INFO "md: %s stopped.\n", mdname(mddev)); printk(KERN_INFO "md: %s stopped.\n", mdname(mddev));
bitmap_destroy(mddev); bitmap_destroy(mddev);
...@@ -3358,10 +3362,6 @@ static int do_md_stop(mddev_t * mddev, int mode) ...@@ -3358,10 +3362,6 @@ static int do_md_stop(mddev_t * mddev, int mode)
mddev->raid_disks = 0; mddev->raid_disks = 0;
mddev->recovery_cp = 0; mddev->recovery_cp = 0;
disk = mddev->gendisk;
if (disk)
set_capacity(disk, 0);
mddev->changed = 1;
} else if (mddev->pers) } else if (mddev->pers)
printk(KERN_INFO "md: %s switched to read-only mode.\n", printk(KERN_INFO "md: %s switched to read-only mode.\n",
mdname(mddev)); mdname(mddev));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment