summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKinga Stefaniuk <kinga.stefaniuk@intel.com>2024-04-26 08:33:00 +0200
committerMariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>2024-08-06 14:40:49 +0200
commitc653054b322a03e8912ac05accc87b6a1ba8daab (patch)
tree2b11bcdbcb3c15d53b1b981935549deb1ecf5268
parentCI: add new gcc 14 (diff)
downloadmdadm-c653054b322a03e8912ac05accc87b6a1ba8daab.tar.xz
mdadm-c653054b322a03e8912ac05accc87b6a1ba8daab.zip
Grow_reshape: set only component_size for size grow
Component_size couldn't be set using ioctl when new drive size is big (e.g. 5TB). Command value is bigger than 32 bits and error is reported - it is known ioctl limitation. Remove updating array properties using ioctl, use sysfs instead. Sysfs was introduced in 3.10, so now it is old enough to be safely used. Array_size in sysfs should be set for every size change for external metadata, when grow is performed without errors. Signed-off-by: Kinga Stefaniuk <kinga.stefaniuk@intel.com>
-rw-r--r--Grow.c19
1 files changed, 7 insertions, 12 deletions
diff --git a/Grow.c b/Grow.c
index a5f9027d..5810b128 100644
--- a/Grow.c
+++ b/Grow.c
@@ -2149,19 +2149,14 @@ int Grow_reshape(char *devname, int fd,
if (s->size == MAX_SIZE)
s->size = 0;
array.size = s->size;
- if (s->size & ~INT32_MAX) {
- /* got truncated to 32bit, write to
- * component_size instead
- */
- rv = sysfs_set_num(sra, NULL, "component_size", s->size);
- } else {
- rv = md_set_array_info(fd, &array);
+ rv = sysfs_set_num(sra, NULL, "component_size", s->size);
- /* manage array size when it is managed externally
- */
- if ((rv == 0) && st->ss->external)
- rv = set_array_size(st, sra, sra->text_version);
- }
+ /*
+ * For native metadata, md/array_size is updated by kernel,
+ * for external management update it here.
+ */
+ if (st->ss->external && rv == MDADM_STATUS_SUCCESS)
+ rv = set_array_size(st, sra, sra->text_version);
if (raid0_takeover) {
/* do not recync non-existing parity,