Grow: give useful message when adding bitmap gives EBUSY.
If adding a bitmap fails with EBUSY, then it is because the array is currently resyncing/recovering/reshaping. As this is non-obvious, give a message explaining the fact. Signed-off-by: NeilBrown <neilb@suse.de>
This commit is contained in:
parent
b3bd581b1d
commit
ff63406404
11
Grow.c
11
Grow.c
|
@ -353,6 +353,10 @@ int Grow_addbitmap(char *devname, int fd, char *file, int chunk, int delay, int
|
|||
}
|
||||
array.state |= (1<<MD_SB_BITMAP_PRESENT);
|
||||
if (ioctl(fd, SET_ARRAY_INFO, &array)!= 0) {
|
||||
if (errno == EBUSY)
|
||||
fprintf(stderr, Name
|
||||
": Cannot add bitmap while array is"
|
||||
" resyncing or reshaping etc.\n");
|
||||
fprintf(stderr, Name ": failed to set internal bitmap.\n");
|
||||
return 1;
|
||||
}
|
||||
|
@ -399,8 +403,13 @@ int Grow_addbitmap(char *devname, int fd, char *file, int chunk, int delay, int
|
|||
return 1;
|
||||
}
|
||||
if (ioctl(fd, SET_BITMAP_FILE, bitmap_fd) < 0) {
|
||||
int err = errno;
|
||||
if (errno == EBUSY)
|
||||
fprintf(stderr, Name
|
||||
": Cannot add bitmap while array is"
|
||||
" resyncing or reshaping etc.\n");
|
||||
fprintf(stderr, Name ": Cannot set bitmap file for %s: %s\n",
|
||||
devname, strerror(errno));
|
||||
devname, strerror(err));
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue