]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
Grow: Handle failure to load superblock in Grow_addbitmap()
authorJes Sorensen <Jes.Sorensen@redhat.com>
Thu, 12 May 2016 18:30:10 +0000 (14:30 -0400)
committerJes Sorensen <Jes.Sorensen@redhat.com>
Thu, 12 May 2016 18:30:10 +0000 (14:30 -0400)
Reported-by: Gioh Kim <gi-oh.kim@profitbricks.com>
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Grow.c

diff --git a/Grow.c b/Grow.c
index 9da72ccfb3e4fe65f076a2e84fd4c78523c0afd0..580c13e1caff55bbc48d6ea44a18ba9632d657f7 100755 (executable)
--- a/Grow.c
+++ b/Grow.c
@@ -421,7 +421,8 @@ int Grow_addbitmap(char *devname, int fd, struct context *c, struct shape *s)
                        fd2 = dev_open(dv, O_RDWR);
                        if (fd2 < 0)
                                continue;
-                       if (st->ss->load_super(st, fd2, NULL)==0) {
+                       rv = st->ss->load_super(st, fd2, NULL);
+                       if (!rv) {
                                if (st->ss->add_internal_bitmap(
                                            st, &s->bitmap_chunk, c->delay,
                                            s->write_behind, bitmapsize,
@@ -432,6 +433,10 @@ int Grow_addbitmap(char *devname, int fd, struct context *c, struct shape *s)
                                        close(fd2);
                                        return 1;
                                }
+                       } else {
+                               pr_err("failed to load super-block.\n");
+                               close(fd2);
+                               return 1;
                        }
                        close(fd2);
                }