Manage: when re-adding, do check avail size if ->sb cannot be found.

avail_size1 requires ->sb, so we must only call it if ->sb
was loaded.

If ->sb wasn't loaded, then we are only proceding on the basis that
the kernel might be able to work something out - we don't need to
do any tests on size.

Reported-by: Christoffer Hammarström <christoffer.hammarstrom@linuxgods.com>
Signed-off-by: NeilBrown <neilb@suse.de>
URL: https://bugs.debian.org/784874
This commit is contained in:
NeilBrown 2015-05-13 14:08:41 +10:00
parent b638e7d440
commit 2609f33902
1 changed files with 2 additions and 1 deletions

View File

@ -781,7 +781,8 @@ int Manage_add(int fd, int tfd, struct mddev_dev *dv,
}
/* Make sure device is large enough */
if (tst->ss->avail_size(tst, ldsize/512, INVALID_SECTORS) <
if (tst->sb &&
tst->ss->avail_size(tst, ldsize/512, INVALID_SECTORS) <
array_size) {
if (dv->disposition == 'M')
return 0;