Skip to content

Commit

Permalink
[PATCH] md/bitmap: fix online removal of file-backed bitmaps
Browse files Browse the repository at this point in the history
When "mdadm --grow /dev/mdX --bitmap=none" is used to remove a filebacked
bitmap, the bitmap was disconnected from the array, but the file wasn't closed
(until the array was stopped).

The file also wasn't closed if adding the bitmap file failed.

Signed-off-by: Neil Brown <neilb@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
  • Loading branch information
NeilBrown authored and Linus Torvalds committed Jun 26, 2006
1 parent 52c0329 commit d7375ab
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions drivers/md/md.c
Original file line number Diff line number Diff line change
Expand Up @@ -3601,10 +3601,13 @@ static int set_bitmap_file(mddev_t *mddev, int fd)
mddev->pers->quiesce(mddev, 1);
if (fd >= 0)
err = bitmap_create(mddev);
if (fd < 0 || err)
if (fd < 0 || err) {
bitmap_destroy(mddev);
fd = -1; /* make sure to put the file */
}
mddev->pers->quiesce(mddev, 0);
} else if (fd < 0) {
}
if (fd < 0) {
if (mddev->bitmap_file)
fput(mddev->bitmap_file);
mddev->bitmap_file = NULL;
Expand Down

0 comments on commit d7375ab

Please sign in to comment.