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:
NeilBrown 2010-11-30 16:34:25 +11:00
parent b3bd581b1d
commit ff63406404
1 changed files with 10 additions and 1 deletions

11
Grow.c
View File

@ -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;
}
}