]> git.ipfire.org Git - thirdparty/mdadm.git/blobdiff - bitmap.c
Don't attempt to create or read bitmaps where the metadata doesn't support it.
[thirdparty/mdadm.git] / bitmap.c
index 088e37d0ad79f90bcf02c31684b2a2c9aeb6f8b4..beef2dcdbb3d558ad5c81da1d16ce6b6774006ca 100644 (file)
--- a/bitmap.c
+++ b/bitmap.c
@@ -227,9 +227,13 @@ bitmap_info_t *bitmap_file_read(char *filename, int brief, struct supertype **st
                if (!st) {
                        /* just look at device... */
                        lseek(fd, 0, 0);
-               } else {
+               } else if (!st->ss->locate_bitmap) {
+                       fprintf(stderr, Name ": No bitmap possible with %s metadata\n",
+                               st->ss->name);
+                       return NULL;
+               } else
                        st->ss->locate_bitmap(st, fd);
-               }
+
                ioctl(fd, BLKFLSBUF, 0); /* make sure we read current data */
                *stp = st;
        } else {