aboutsummaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorNeil Brown <neilb@suse.de>2007-08-12 00:18:08 +0200
committerAdrian Bunk <bunk@stusta.de>2007-08-12 00:18:08 +0200
commitddd0593c7408afa9dcc29db6a80669761107ee3c (patch)
tree0ad2f9bae87f83d5a6e7e44e06b326b3b98da1a7 /drivers
parent1da6843b983e8bebefa78f15e433320c56c27477 (diff)
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: Adrian Bunk <bunk@kernel.org>
Diffstat (limited to 'drivers')
-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 489eaf31a96..0d26b39e8a1 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -3356,10 +3356,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;