Skip to contentSkip to conversation

Grow: block -n on external volumes.

PATCH Applied Mateusz Kusiak 3 participants 3 messages May 19, 2022 – Jun 9, 2022 MD RAID

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Grow: block -n on external volumes.

Performing --raid-devices on external metadata volume should be blocked as it causes unwanted behaviour.

Eg. Performing
mdadm -G /dev/md/volume -l10 -n4
on r0_d2 inside 4 disk container, returns
mdadm: Need 2 spares to avoid degraded array, only have 0.

---
 Grow.c | 8 ++++++++
 1 file changed, 8 insertions(+)
Grow.c +8 -0
index 8a242b0f..f6efbc48 100644
@@ -1892,6 +1892,14 @@ int Grow_reshape(char *devname, int fd,
 
 		if (retval) {
 			pr_err("Cannot read superblock for %s\n", devname);
+			close(cfd);
+			free(subarray);
+			return 1;
+		}
+
+		if (s->raiddisks && subarray) {
+			pr_err("--raid-devices operation can be performed on a container only\n");
+			close(cfd);
 			free(subarray);
 			return 1;
 		}
Signature · 1 line
2.26.2
#1 lore raw
Quoted 22 lines · Mateusz Kusiak

Performing --raid-devices on external metadata volume should be blocked as it causes unwanted behaviour.

Eg. Performing
mdadm -G /dev/md/volume -l10 -n4
on r0_d2 inside 4 disk container, returns
mdadm: Need 2 spares to avoid degraded array, only have 0.

---
  Grow.c | 8 ++++++++
  1 file changed, 8 insertions(+)
Grow.c +1 -0
index 8a242b0f..f6efbc48 100644
@@ -1892,6 +1892,14 @@ int Grow_reshape(char *devname, int fd,
 
  		if (retval) {
  			pr_err("Cannot read superblock for %s\n", devname);
+			close(cfd);

Grow.c int Grow_reshape(char *devname, int fd, · line 1905

Quoted 10 lines
Grow.c +7 -0
+			free(subarray);
+			return 1;
+		}
+
+		if (s->raiddisks && subarray) {
+			pr_err("--raid-devices operation can be performed on a container only\n");
+			close(cfd);
  			free(subarray);
  			return 1;
  		}

Hi Mateusz,

It seems the above patch has some both-modified part with a previous posted patch "Grow: Split Grow_reshape into helper function."

I will skip this patch and test/review rested patches. Once them are all done, could you please post a rebased version again then?

Thanks.

Coly Li

Applied
#2 lore raw
In reply to Mateusz Kusiak
Quoted 8 lines · Mateusz Kusiak

Performing --raid-devices on external metadata volume should be blocked as it causes unwanted behaviour.

Eg. Performing
mdadm -G /dev/md/volume -l10 -n4
on r0_d2 inside 4 disk container, returns
mdadm: Need 2 spares to avoid degraded array, only have 0.

Quoted 4 lines
---
 Grow.c | 8 ++++++++
 1 file changed, 8 insertions(+)

Applied!

Thanks,
Jes