md: fix error paths from bitmap_create.
authorNeilBrown <neilb@suse.de>
Wed, 25 Feb 2015 00:44:11 +0000 (11:44 +1100)
committerNeilBrown <neilb@suse.de>
Wed, 25 Feb 2015 00:44:11 +0000 (11:44 +1100)
Recent change to bitmap_create mishandles errors.
In particular a failure doesn't alway cause 'err' to be set.

Signed-off-by: NeilBrown <neilb@suse.de>
drivers/md/md.c

index 5703c2e89f3a7b7f2042113ce9a322eed8559c60..ae3432e57ccb1d1c74346d5b68ed2204e4f5f921 100644 (file)
@@ -6118,7 +6118,8 @@ static int set_bitmap_file(struct mddev *mddev, int fd)
                        if (!IS_ERR(bitmap)) {
                                mddev->bitmap = bitmap;
                                err = bitmap_load(mddev);
-                       }
+                       } else
+                               err = PTR_ERR(bitmap);
                }
                if (fd < 0 || err) {
                        bitmap_destroy(mddev);
@@ -6408,7 +6409,8 @@ static int update_array_info(struct mddev *mddev, mdu_array_info_t *info)
                        if (!IS_ERR(bitmap)) {
                                mddev->bitmap = bitmap;
                                rv = bitmap_load(mddev);
-                       }
+                       } else
+                               rv = PTR_ERR(bitmap);
                        if (rv)
                                bitmap_destroy(mddev);
                        mddev->pers->quiesce(mddev, 0);