Skip to contentSkip to conversation

mdadm: fix reshape from RAID5 to RAID6 with backup file

PATCH Applied Nigel Croxon 3 participants 8 messages Jan 20, 2021 – Mar 17, 2021 MD RAID

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mdadm: fix reshape from RAID5 to RAID6 with backup file

Reshaping a 3-disk RAID5 to 4-disk RAID6 will cause a hang of the resync after the grow.

Adding a spare disk to avoid degrading the array when growing is successful, but not successful when supplying a backup file on the command line. If the reshape job is not already running, set the sync_max value to max.

---
 Grow.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
Grow.c +5 -2
index 6b8321c..5c2512f 100644
@@ -931,12 +931,15 @@ int start_reshape(struct mdinfo *sra, int already_running,
 	err = err ?: sysfs_set_num(sra, NULL, "sync_max", sync_max_to_set);
 	if (!already_running && err == 0) {
 		int cnt = 5;
+		int err2;
 		do {
 			err = sysfs_set_str(sra, NULL, "sync_action",
 					    "reshape");
-			if (err)
+			err2 = sysfs_set_str(sra, NULL, "sync_max",
+					    "max");
+			if (err || err2)
 				sleep(1);
-		} while (err && errno == EBUSY && cnt-- > 0);
+		} while (err && err2 && errno == EBUSY && cnt-- > 0);
 	}
 	return err;
 }
Signature · 1 line
2.20.1
#1 lore raw

Any update on accepting this patch ?

Quoted 40 lines · Nigel Croxon

Reshaping a 3-disk RAID5 to 4-disk RAID6 will cause a hang of the resync after the grow.

Adding a spare disk to avoid degrading the array when growing is successful, but not successful when supplying a backup file on the command line. If the reshape job is not already running, set the sync_max value to max.

---
Grow.c | 7 +++++--

1 file changed, 5 insertions(+), 2 deletions(-)
Grow.c +5 -2
index 6b8321c..5c2512f 100644
@@ -931,12 +931,15 @@ int start_reshape(struct mdinfo *sra, int already_running,
 	err = err ?: sysfs_set_num(sra, NULL, "sync_max", sync_max_to_set);
 	if (!already_running && err == 0) {
 		int cnt = 5;
+		int err2;
 		do {
 			err = sysfs_set_str(sra, NULL, "sync_action",
 					    "reshape");
-			if (err)
+			err2 = sysfs_set_str(sra, NULL, "sync_max",
+					    "max");
+			if (err || err2)
 				sleep(1);
-		} while (err && errno == EBUSY && cnt-- > 0);
+		} while (err && err2 && errno == EBUSY && cnt-- > 0);
 	}
 	return err;
 }
Signature · 1 line
2.20.1
Applied
#2 lore raw
In reply to Nigel Croxon
Quoted 8 lines · Nigel Croxon

Reshaping a 3-disk RAID5 to 4-disk RAID6 will cause a hang of the resync after the grow.

Adding a spare disk to avoid degrading the array when growing is successful, but not successful when supplying a backup file on the command line. If the reshape job is not already running, set the sync_max value to max.

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

Applied!

Thanks,
Jes

#3 lore raw

Hello Nigel,

Blame told us, that yours patch introduce regression in following scenario:

#mdadm -CR imsm0 -e imsm -n4 /dev/nvme[0125]n1
#mdadm -CR volume -l0 --chunk 64 --raid-devices=1 /dev/nvme0n1 --force #mdadm -G /dev/md/imsm0 -n2

At the end of reshape, level doesn't back to RAID0. Could you look into it?
Let me know, if you need support.

Thanks,
Mariusz

#4 lore raw

Thanks for the heads up Mariusz.

I will look into this now.

-Nigel

Quoted 18 lines · Mariusz

Hello Nigel,

Blame told us, that yours patch introduce regression in following scenario:

#mdadm -CR imsm0 -e imsm -n4 /dev/nvme[0125]n1
#mdadm -CR volume -l0 --chunk 64 --raid-devices=1 /dev/nvme0n1 --force #mdadm -G /dev/md/imsm0 -n2

At the end of reshape, level doesn't back to RAID0. Could you look into it?
Let me know, if you need support.

Thanks,
Mariusz

#5 lore raw
In reply to Tkaczyk, Mariusz

I’m trying your situation without my patch (its reverted) and I’m not seeing success.

[root@fedora33 mdadmupstream]# mdadm -CR volume -l0 --chunk 64 --raid-devices=1 /dev/nvme0n1 --force
mdadm: /dev/nvme0n1 appears to be part of a raid array:

       level=container devices=0 ctime=Wed Dec 31 19:00:00 1969

mdadm: Creating array inside imsm container md127
mdadm: array /dev/md/volume started.

[root@fedora33 mdadmupstream]# cat /proc/mdstat
Personalities : [raid6] [raid5] [raid4] [raid0]
md126 : active raid0 nvme0n1[0]

      500102144 blocks super external:/md127/0 64k chunks

md127 : inactive nvme3n1[3](S) nvme2n1[2](S) nvme1n1[1](S) nvme0n1[0](S)
4420 blocks super external:imsm

unused devices: <none>
[root@fedora33 mdadmupstream]# mdadm -G /dev/md/imsm0 -n2 [root@fedora33 mdadmupstream]# cat /proc/mdstat Personalities : [raid6] [raid5] [raid4] [raid0] md126 : active raid4 nvme3n1[2] nvme0n1[0]

      500102144 blocks super external:-md127/0 level 4, 64k chunk, algorithm 5 [2/1] [U_]

md127 : inactive nvme3n1[3](S) nvme2n1[2](S) nvme1n1[1](S) nvme0n1[0](S)
4420 blocks super external:imsm

unused devices: <none>

dmesg says:
[Mar16 11:46] md/raid:md126: device nvme0n1 operational as raid disk 0

[  +0.011147] md/raid:md126: raid level 4 active with 1 out of 2 devices, algorithm 5
[  +0.044605] md/raid0:md126: raid5 must have missing parity disk!
[  +0.000002] md: md126: raid0 would not accept array
Quoted 18 lines · Mariusz

Hello Nigel,

Blame told us, that yours patch introduce regression in following scenario:

#mdadm -CR imsm0 -e imsm -n4 /dev/nvme[0125]n1
#mdadm -CR volume -l0 --chunk 64 --raid-devices=1 /dev/nvme0n1 --force #mdadm -G /dev/md/imsm0 -n2

At the end of reshape, level doesn't back to RAID0. Could you look into it?
Let me know, if you need support.

Thanks,
Mariusz

#6 lore raw
In reply to Tkaczyk, Mariusz

----- Original Message -----
From: "Mariusz Tkaczyk" <[email protected]>
To: "Jes Sorensen" <[email protected]>, "Nigel Croxon" <[email protected]>, [email protected], [email protected]
Sent: Tuesday, March 16, 2021 10:54:22 AM
Subject: Re: [PATCH] mdadm: fix reshape from RAID5 to RAID6 with backup file

Hello Nigel,

Blame told us, that yours patch introduce regression in following scenario:

#mdadm -CR imsm0 -e imsm -n4 /dev/nvme[0125]n1
#mdadm -CR volume -l0 --chunk 64 --raid-devices=1 /dev/nvme0n1 --force #mdadm -G /dev/md/imsm0 -n2

At the end of reshape, level doesn't back to RAID0. Could you look into it?
Let me know, if you need support.

Thanks,
Mariusz

I’m trying your situation without my patch (its reverted) and I’m not seeing success. See the dmesg log.

[root@fedora33 mdadmupstream]# mdadm -CR volume -l0 --chunk 64 --raid-devices=1 /dev/nvme0n1 --force
mdadm: /dev/nvme0n1 appears to be part of a raid array:

      level=container devices=0 ctime=Wed Dec 31 19:00:00 1969

mdadm: Creating array inside imsm container md127
mdadm: array /dev/md/volume started.

[root@fedora33 mdadmupstream]# cat /proc/mdstat
Personalities : [raid6] [raid5] [raid4] [raid0]
md126 : active raid0 nvme0n1[0]

     500102144 blocks super external:/md127/0 64k chunks

md127 : inactive nvme3n1[3](S) nvme2n1[2](S) nvme1n1[1](S) nvme0n1[0](S)
4420 blocks super external:imsm

unused devices: <none>
[root@fedora33 mdadmupstream]# mdadm -G /dev/md/imsm0 -n2 [root@fedora33 mdadmupstream]# cat /proc/mdstat Personalities : [raid6] [raid5] [raid4] [raid0] md126 : active raid4 nvme3n1[2] nvme0n1[0]

     500102144 blocks super external:-md127/0 level 4, 64k chunk, algorithm 5 [2/1] [U_]

md127 : inactive nvme3n1[3](S) nvme2n1[2](S) nvme1n1[1](S) nvme0n1[0](S)
4420 blocks super external:imsm

unused devices: <none>

dmesg says:
[Mar16 11:46] md/raid:md126: device nvme0n1 operational as raid disk 0

[  +0.011147] md/raid:md126: raid level 4 active with 1 out of 2 devices, algorithm 5
[  +0.044605] md/raid0:md126: raid5 must have missing parity disk!
[  +0.000002] md: md126: raid0 would not accept array

-Nigel

#7 lore raw
Quoted 55 lines · Nigel Croxon

----- Original Message -----
From: "Mariusz Tkaczyk" <[email protected]>
To: "Jes Sorensen" <[email protected]>, "Nigel Croxon" <[email protected]>, [email protected], [email protected]
Sent: Tuesday, March 16, 2021 10:54:22 AM
Subject: Re: [PATCH] mdadm: fix reshape from RAID5 to RAID6 with backup file

Hello Nigel,

Blame told us, that yours patch introduce regression in following scenario:

#mdadm -CR imsm0 -e imsm -n4 /dev/nvme[0125]n1
#mdadm -CR volume -l0 --chunk 64 --raid-devices=1 /dev/nvme0n1 --force #mdadm -G /dev/md/imsm0 -n2

At the end of reshape, level doesn't back to RAID0. Could you look into it?
Let me know, if you need support.

Thanks,
Mariusz

I’m trying your situation without my patch (its reverted) and I’m not seeing success. See the dmesg log.

[root@fedora33 mdadmupstream]# mdadm -CR volume -l0 --chunk 64 --raid-devices=1 /dev/nvme0n1 --force
mdadm: /dev/nvme0n1 appears to be part of a raid array:

       level=container devices=0 ctime=Wed Dec 31 19:00:00 1969

mdadm: Creating array inside imsm container md127
mdadm: array /dev/md/volume started.

[root@fedora33 mdadmupstream]# cat /proc/mdstat
Personalities : [raid6] [raid5] [raid4] [raid0]
md126 : active raid0 nvme0n1[0]

      500102144 blocks super external:/md127/0 64k chunks

md127 : inactive nvme3n1[3](S) nvme2n1[2](S) nvme1n1[1](S) nvme0n1[0](S)
4420 blocks super external:imsm

unused devices: <none>
[root@fedora33 mdadmupstream]# mdadm -G /dev/md/imsm0 -n2 [root@fedora33 mdadmupstream]# cat /proc/mdstat Personalities : [raid6] [raid5] [raid4] [raid0] md126 : active raid4 nvme3n1[2] nvme0n1[0]

      500102144 blocks super external:-md127/0 level 4, 64k chunk, algorithm 5 [2/1] [U_]

md127 : inactive nvme3n1[3](S) nvme2n1[2](S) nvme1n1[1](S) nvme0n1[0](S)
4420 blocks super external:imsm

unused devices: <none>

Quoted 8 lines

dmesg says:
[Mar16 11:46] md/raid:md126: device nvme0n1 operational as raid disk 0

[  +0.011147] md/raid:md126: raid level 4 active with 1 out of 2 devices, algorithm 5
[  +0.044605] md/raid0:md126: raid5 must have missing parity disk!
[  +0.000002] md: md126: raid0 would not accept array

-Nigel

Hello Nigel,
It looks strange. Could you try to reproduce it with --size, less than smaller drive in array (e.g. 10G)?

If it doesn't help please provide me your kernel version. I will try to reproduce it myself.

Thanks,
Mariusz