Commit 978f946b authored by NeilBrown's avatar NeilBrown Committed by Linus Torvalds

[PATCH] md: Don't remove bitmap from md array when switching to read-only

While a read-only array doesn't not really need a bitmap, we should
not remove the bitmap when switching an array to read-only because
 a/ There is no code to re-add the bitmap which switching to read-write,
 b/ There is insufficient locking - the bitmap could be accessed while it is
    being removed.

Cc: Reuben Farrelly <reuben-lkml@reub.net>
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 f0ca340c
...@@ -2689,14 +2689,6 @@ static int do_md_stop(mddev_t * mddev, int ro) ...@@ -2689,14 +2689,6 @@ static int do_md_stop(mddev_t * mddev, int ro)
set_disk_ro(disk, 1); set_disk_ro(disk, 1);
} }
bitmap_destroy(mddev);
if (mddev->bitmap_file) {
atomic_set(&mddev->bitmap_file->f_dentry->d_inode->i_writecount, 1);
fput(mddev->bitmap_file);
mddev->bitmap_file = NULL;
}
mddev->bitmap_offset = 0;
/* /*
* Free resources if final stop * Free resources if final stop
*/ */
...@@ -2706,6 +2698,14 @@ static int do_md_stop(mddev_t * mddev, int ro) ...@@ -2706,6 +2698,14 @@ static int do_md_stop(mddev_t * mddev, int ro)
struct gendisk *disk; struct gendisk *disk;
printk(KERN_INFO "md: %s stopped.\n", mdname(mddev)); printk(KERN_INFO "md: %s stopped.\n", mdname(mddev));
bitmap_destroy(mddev);
if (mddev->bitmap_file) {
atomic_set(&mddev->bitmap_file->f_dentry->d_inode->i_writecount, 1);
fput(mddev->bitmap_file);
mddev->bitmap_file = NULL;
}
mddev->bitmap_offset = 0;
ITERATE_RDEV(mddev,rdev,tmp) ITERATE_RDEV(mddev,rdev,tmp)
if (rdev->raid_disk >= 0) { if (rdev->raid_disk >= 0) {
char nm[20]; char nm[20];
......
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