]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
Manage: when re-adding, do check avail size if ->sb cannot be found.
authorNeilBrown <neilb@suse.de>
Wed, 13 May 2015 04:08:41 +0000 (14:08 +1000)
committerNeilBrown <neilb@suse.de>
Wed, 13 May 2015 04:08:41 +0000 (14:08 +1000)
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

Manage.c

index 225af81384cba26d82ba3bad3da6639ecbe8e07f..2e602d74aa821ee17e70c5b00a735505616d3b1b 100644 (file)
--- a/Manage.c
+++ b/Manage.c
@@ -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;