File 0197-mdadm-grow-adding-a-test-to-ensure-resize-was-requir.patch of Package mdadm.12486

From 1b21c449e6f2c81eb75cc0a6fc81b3edbefae5a3 Mon Sep 17 00:00:00 2001
From: Zhilong Liu <zlliu@suse.com>
Date: Wed, 11 Oct 2017 16:53:12 +0800
Subject: [PATCH] mdadm/grow: adding a test to ensure resize was required
Git-commit: 1b21c449e6f2c81eb75cc0a6fc81b3edbefae5a3
Patch-mainline: mdadm-4.0+
References: bsc#1069165, bsc#1069167, bsc#1068030

To fix the commit: 4b74a905a67e
(mdadm/grow: Component size must be larger than chunk size)

array.level > 1 : against the raids which chunk_size is meaningful.
s->size > 0 : ensure that changing component size has required.
array.chunk_size / 1024 > s->size : ensure component size should
be always >= current chunk_size when requires resize, otherwise,
mddev->pers->resize would be set mddev->dev_sectors as '0'.

Reported-by: Tomasz Majchrzak <tomasz.majchrzak@intel.com>
Suggested-by: NeilBrown <neilb@suse.com>
Signed-off-by: Zhilong Liu <zlliu@suse.com>
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
Signed-off-by: Coly Li <colyli@suse.de>

---
 Grow.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Grow.c b/Grow.c
index 4d79d83..0f9e89b 100644
--- a/Grow.c
+++ b/Grow.c
@@ -1809,8 +1809,8 @@ int Grow_reshape(char *devname, int fd,
 		return 1;
 	}
 
-	if (array.level > 1 &&
-	   (array.chunk_size / 1024) > (int)s->size) {
+	if (array.level > 1 && s->size > 0 &&
+	    (array.chunk_size / 1024) > (int)s->size) {
 		pr_err("component size must be larger than chunk size.\n");
 		return 1;
 	}
-- 
2.13.6

openSUSE Build Service is sponsored by