summaryrefslogtreecommitdiffstats
path: root/drivers/md
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2006-06-26 00:27:43 -0700
committerLinus Torvalds <torvalds@g5.osdl.org>2006-06-26 09:58:38 -0700
commitd7375ab324971e7acbea9f02a0269ae7348f4147 (patch)
tree0a2e2f17a6ed37be1870b2bcc2b02cd6cf7e8cf2 /drivers/md
parent52c03291a832d86c093996d0491a326de4a6b79b (diff)
downloadlinux-d7375ab324971e7acbea9f02a0269ae7348f4147.tar.gz
linux-d7375ab324971e7acbea9f02a0269ae7348f4147.tar.bz2
linux-d7375ab324971e7acbea9f02a0269ae7348f4147.zip
[PATCH] md/bitmap: fix online removal of file-backed bitmaps
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>
Diffstat (limited to 'drivers/md')
-rw-r--r--drivers/md/md.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 8c1e1900893d..ea6837d45fc8 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -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;