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>
This commit is contained in:
parent
9b0502b879
commit
ebeb366382
5
Create.c
5
Create.c
|
@ -651,6 +651,11 @@ int Create(struct supertype *st, char *mddev,
|
|||
fprintf(stderr, Name ": internal bitmaps not supported by this kernel.\n");
|
||||
goto abort;
|
||||
}
|
||||
if (!st->ss->add_internal_bitmap) {
|
||||
fprintf(stderr, Name ": internal bitmaps not supported with %s metadata\n",
|
||||
st->ss->name);
|
||||
goto abort;
|
||||
}
|
||||
if (!st->ss->add_internal_bitmap(st, &bitmap_chunk,
|
||||
delay, write_behind,
|
||||
bitmapsize, 1, major_num)) {
|
||||
|
|
5
Grow.c
5
Grow.c
|
@ -288,6 +288,11 @@ int Grow_addbitmap(char *devname, int fd, char *file, int chunk, int delay, int
|
|||
return 1;
|
||||
} else if (strcmp(file, "internal") == 0) {
|
||||
int d;
|
||||
if (st->ss->add_internal_bitmap == NULL) {
|
||||
fprintf(stderr, Name ": Internal bitmaps not supported "
|
||||
"with %s metadata\n", st->ss->name);
|
||||
return 1;
|
||||
}
|
||||
for (d=0; d< st->max_devs; d++) {
|
||||
mdu_disk_info_t disk;
|
||||
char *dv;
|
||||
|
|
8
bitmap.c
8
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 {
|
||||
|
|
Loading…
Reference in New Issue