]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
md/bitmap: fix online removal of file-backed bitmaps
authorNeil Brown <neilb@suse.de>
Sat, 11 Aug 2007 22:18:08 +0000 (00:18 +0200)
committerAdrian Bunk <bunk@stusta.de>
Sat, 11 Aug 2007 22:18:08 +0000 (00:18 +0200)
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>
drivers/md/md.c

index 489eaf31a96c7e0422e27a628c36f996a4f4e261..0d26b39e8a13f6b19e3c2645852b73db87982a86 100644 (file)
@@ -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;