summaryrefslogtreecommitdiffstats
path: root/bitmap.c
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2010-03-24 11:57:42 +1100
committerNeilBrown <neilb@suse.de>2010-04-07 09:18:01 +1000
commitebeb36638225e86826052400c1c538857bc7c461 (patch)
treed13ddb6bab316f6c971c295f7f003cb04a45bff9 /bitmap.c
parent9b0502b879dc6308428bc2bce4f8e1b56fc93f6c (diff)
downloadmdadm-ebeb36638225e86826052400c1c538857bc7c461.tar.gz
mdadm-ebeb36638225e86826052400c1c538857bc7c461.tar.xz
mdadm-ebeb36638225e86826052400c1c538857bc7c461.zip
Don't attempt to create or read bitmaps where the metadata doesn't support it.
In particular, if the relevant bitmap method is NULL, don't try to call it, print an error instead. Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'bitmap.c')
-rw-r--r--bitmap.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/bitmap.c b/bitmap.c
index 088e37d..beef2dc 100644
--- 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 {