File 0001-Manage-when-re-adding-do-check-avail-size-if-sb-cann.patch of Package mdadm.1739
From 2609f339028a6035a3fadb1190b565438000e35c Mon Sep 17 00:00:00 2001
From: NeilBrown <neilb@suse.de>
Date: Wed, 13 May 2015 14:08:41 +1000
Subject: [PATCH] Manage: when re-adding, do check avail size if ->sb cannot be
found.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
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 | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
--- a/Manage.c
+++ b/Manage.c
@@ -808,7 +808,8 @@ int Manage_add(int fd, int tfd, struct m
}
/* 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;