mdadm/grow: reshape would be stuck from raid1 to raid5
PATCH 1/1 mdadm/grow: reshape would be stuck from raid1 to raid5
it would be stuck at the beginning of reshape progress when grows array from raid1 to raid5, correct the name of [email protected] in continue_via_systemd.
reproduce steps:
./mdadm -CR /dev/md0 -l1 -b internal -n2 /dev/loop[0-1] ./mdadm --grow /dev/md0 -l5 -n3 -a /dev/loop2
--- Grow.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
Grow.c +2 -4
@@ -2808,13 +2808,11 @@ static int continue_via_systemd(char *devnm)*/ close (2 );open ("/dev/null" ,O_WRONLY ); -snprintf (pathbuf,sizeof (pathbuf),"mdadm-grow-continue@%s.service" , - devnm); +snprintf (pathbuf,sizeof (pathbuf),"[email protected]" ); status =execl ("/usr/bin/systemctl" ,"systemctl" ,"start" , pathbuf,NULL ); - status =execl ("/bin/systemctl" ,"systemctl" ,"start" , - pathbuf,NULL ); +pr_err ("/usr/bin/systemctl %s got failure\n" , pathbuf);exit (1 );case -1 :/* Just do it ourselves. */ break ;
Signature · 1 line
2.6.6
Quoted 18 lines · Zhilong Liu
it would be stuck at the beginning of reshape progress when grows array from raid1 to raid5, correct the name of [email protected] in
continue_via_systemd.reproduce steps:
./mdadm -CR/dev/md0-l1 -b internal -n2 /dev/loop[0-1] ./mdadm --grow/dev/md0-l5 -n3 -a/dev/loop2Signed-off-by Zhilong Liu <[email protected]>--- Grow.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)Grow.c +0
-0
Grow.c static int continue_via_systemd(char *devnm) · line 2811
Quoted 6 lines
Grow.c +1
-2@@ -2808,13 +2808,11 @@ static int continue_via_systemd(char *devnm)*/ close (2 );open ("/dev/null" ,O_WRONLY ); -snprintf (pathbuf,sizeof (pathbuf),"mdadm-grow-continue@%s.service" , - devnm); +snprintf (pathbuf,sizeof (pathbuf),"[email protected]" );
My memory is rusty here, isn't systemctl interpreting the device name in mdadm-grow-continue@<device>.service as an argument?
Grow.c static int continue_via_systemd(char *devnm) · line 2816
Quoted 7 lines
Grow.c +1
-2status =execl ("/usr/bin/systemctl" ,"systemctl" ,"start" , pathbuf,NULL ); - status =execl ("/bin/systemctl" ,"systemctl" ,"start" , - pathbuf,NULL ); +pr_err ("/usr/bin/systemctl %s got failure\n" , pathbuf);exit (1 );
This assumes systemctl is location in /usr/bin only - you removed the fallback case for it being location in /bin.
In addition, instead of saying 'got failure' lets do something with the errno value so the user gets a more descriptive error message.
Cheers,
Jes
Quoted 14 lines · On 03/28/2017 06:10 AM, [email protected] wrote:
Quoted 13 lines · Zhilong Liu
it would be stuck at the beginning of reshape progress when grows array from raid1 to raid5, correct the name of [email protected] in
continue_via_systemd.reproduce steps:
./mdadm -CR/dev/md0-l1 -b internal -n2 /dev/loop[0-1] ./mdadm --grow/dev/md0-l5 -n3 -a/dev/loop2Signed-off-by Zhilong Liu <[email protected]>--- Grow.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
Quoted 13 lines
Grow.c static int continue_via_systemd(char *devnm) · line 2811
Quoted 11 lines
Grow.c +1
-2@@ -2808,13 +2808,11 @@ static int continue_via_systemd(char *devnm)*/ close (2 );open ("/dev/null" ,O_WRONLY ); -snprintf (pathbuf,sizeof (pathbuf),"mdadm-grow-continue@%s.service" , - devnm); +snprintf (pathbuf,sizeof (pathbuf),"[email protected]" );My memory is rusty here, isn't systemctl interpreting the device name in mdadm-grow-continue@<device>.service as an argument?
actually, the service started failed. paste the journalctl log here when reshape from mirror to raid5.
command: ./mdadm --grow /dev/md0 -l5 -n3 -a /dev/loop2
Mar 28 21:43:47 linux-g0sr kernel: --- level:5 rd:3 wd:3 Mar 28 21:43:47 linux-g0sr kernel: disk 0, o:1, dev:loop0 Mar 28 21:43:47 linux-g0sr kernel: disk 1, o:1, dev:loop1 Mar 28 21:43:47 linux-g0sr kernel: disk 2, o:1, dev:loop2 Mar 28 21:43:47 linux-g0sr kernel: md: reshape of RAID array md0 Mar 28 21:43:47 linux-g0sr kernel: md: minimum _guaranteed_ speed: 1000 KB/sec/disk. Mar 28 21:43:47 linux-g0sr kernel: md: using maximum available idle IO bandwidth (but not more than 2000 KB/sec) for reshape. Mar 28 21:43:47 linux-g0sr kernel: md: using 128k window, over a total of 19968k. Mar 28 21:43:47 linux-g0sr systemd[1]: Started Manage MD Reshape on /dev/md0. Mar 28 21:43:47 linux-g0sr systemd[1]: [email protected]: Main process exited, code=exited, status=2/INVALIDARGUMENT Mar 28 21:43:47 linux-g0sr systemd[1]: [email protected]: Unit entered failed state. Mar 28 21:43:47 linux-g0sr systemd[1]: [email protected]: Failed with result 'exit-code'. Mar 28 21:44:03 linux-g0sr kernel: md: md0: reshape interrupted.
Quoted 11 lines
Grow.c static int continue_via_systemd(char *devnm) · line 2816
Quoted 8 lines
Grow.c +1
-2status =execl ("/usr/bin/systemctl" ,"systemctl" ,"start" , pathbuf,NULL ); - status =execl ("/bin/systemctl" ,"systemctl" ,"start" , - pathbuf,NULL ); +pr_err ("/usr/bin/systemctl %s got failure\n" , pathbuf);exit (1 );This assumes systemctl is location in
/usr/binonly - you removed the fallback case for it being location in /bin.
Quoted 2 lines
In addition, instead of saying 'got failure' lets do something with the errno value so the user gets a more descriptive error message.
I would continue to look at this issue, thanks for your time.
Thanks,
-Zhilong
Quoted 7 lines
Cheers,
Jes
--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 1/1 mdadm/grow: reshape would be stuck from raid1 to raid5
In reply to [email protected]systemctl doesn't interpret [email protected] correctly due to the wrong argument provided in [service], it should be corrected %I as %i. Otherwise, if the service cannot start by systemctl and the reshap progress would be stuck all time when grows array from raid1 to raid5.
reproduce steps:
./mdadm -CR /dev/md0 -l1 -b internal -n2 /dev/loop[0-1] ./mdadm --grow /dev/md0 -l5 -n3 -a /dev/loop2
--- systemd/[email protected] | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
systemd/[email protected] +1 -1
@@ -10,7 +10,7 @@ Description=Manage MD Reshape on /dev/%I DefaultDependencies=no [Service] -ExecStart=BINDIR/mdadm --grow --continue /dev/%I +ExecStart=BINDIR/mdadm --grow --continue /dev/%i StandardInput=null StandardOutput=null StandardError=null
Signature · 1 line
2.10.2
Jes Sorensen
AppliedQuoted 6 lines · Zhilong Liu
systemctl doesn't interpret [email protected] correctly due to the wrong argument provided in [service], it should be corrected %I as %i. Otherwise, if the service cannot start by systemctl and the reshap progress would be stuck all time when grows array from raid1 to raid5.
Quoted 8 lines
reproduce steps:
./mdadm -CR/dev/md0-l1 -b internal -n2 /dev/loop[0-1] ./mdadm --grow/dev/md0-l5 -n3 -a/dev/loop2Signed-off-by Zhilong Liu <[email protected]>--- systemd/[email protected] | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
This solution looks more correct to me :)
Applied!
Thanks,
Jes
Quoted 20 lines · Zhilong Liu
systemctl doesn't interpret [email protected] correctly due to the wrong argument provided in [service], it should be corrected %I as %i. Otherwise, if the service cannot start by systemctl and the reshap progress would be stuck all time when grows array from raid1 to raid5.
reproduce steps:
./mdadm -CR/dev/md0-l1 -b internal -n2 /dev/loop[0-1] ./mdadm --grow/dev/md0-l5 -n3 -a/dev/loop2Signed-off-by Zhilong Liu <[email protected]>--- systemd/[email protected] | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)systemd/[email protected] +0
-0
systemd/[email protected] Description=Manage MD Reshape on /dev/%I · line 13
Quoted 5 lines
systemd/[email protected] +1
-1@@ -10,7 +10,7 @@ Description=Manage MD Reshape on /dev/%I DefaultDependencies=no [Service] -ExecStart=BINDIR/mdadm --grow --continue /dev/%I +ExecStart=BINDIR/mdadm --grow --continue /dev/%i
Do you know why this makes a difference? I don't think it should. man systemd.unit says that "%i" is the "Instance name" while "%I" is the "Unescaped instance name".
The Instance name here is something like "md0" so there is nothing to escape.
I would rather not change it unless we know exactly why it is broken, and I don't find your explanation to be convincing.
NeilBrown
Quoted 10 lines
systemd/[email protected] +0
-0StandardInput=null StandardOutput=null StandardError=nullSignature · 6 lines
2.10.2 -- To unsubscribe from this list: send the line "unsubscribe linux-raid" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Send from iPhone
Quoted 34 lines · 在 2017年4月3日,12:36,NeilBrown <[email protected]> 写道:
Quoted 26 lines · Zhilong Liu
systemctl doesn't interpret [email protected] correctly due to the wrong argument provided in [service], it should be corrected %I as %i. Otherwise, if the service cannot start by systemctl and the reshap progress would be stuck all time when grows array from raid1 to raid5.
reproduce steps:
./mdadm -CR/dev/md0-l1 -b internal -n2 /dev/loop[0-1] ./mdadm --grow/dev/md0-l5 -n3 -a/dev/loop2Signed-off-by Zhilong Liu <[email protected]>---
systemd/[email protected] | 2 +-1 file changed, 1 insertion(+), 1 deletion(-)systemd/[email protected] +0
-0@@ -10,7 +10,7 @@ Description=Manage MD Reshape on /dev/%IDefaultDependencies=no
[Service]
systemd/[email protected] Description=Manage MD Reshape on /dev/%I · line 13
Quoted 2 lines
systemd/[email protected] +1
-1-ExecStart=BINDIR/mdadm --grow --continue /dev/%I +ExecStart=BINDIR/mdadm --grow --continue /dev/%iDo you know why this makes a difference? I don't think it should. man systemd.unit says that "%i" is the "Instance name" while "%I" is the "Unescaped instance name".
Quoted 6 lines
The Instance name here is something like "md0" so there is nothing to escape.
I would rather not change it unless we know exactly why it is broken, and I don't find your explanation to be convincing.
Exactly, you're correct, in this case, %i and %I are the same. The root cause is the ExecStart part, all the path name should be verified by systemd-escape,such as:/sbin/mdadm should be corrected as sbin-mdadm, and /dev/%I should be -dev-%I. Thus I'm sorry for this patch, I do agree with you not to change it. And say sorry to Jes.
Thanks
-zhilong
Quoted 13 lines
NeilBrown
Quoted 10 lines
StandardInput=null
StandardOutput=null
StandardError=nullSignature · 6 lines
2.10.2 -- To unsubscribe from this list: send the line "unsubscribe linux-raid" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Send from iPhone
Quoted 43 lines · 在 2017年4月4日,13:07,Zhilong <[email protected]> 写道:
Send from iPhone
Quoted 37 lines
Quoted 27 lines · 在 2017年4月3日,12:36,NeilBrown <[email protected]> 写道:
On Thu, Mar 30 2017, Zhilong Liu wrote:
systemctl doesn't interpret [email protected] correctly due to the wrong argument provided in [service], it should be corrected %I as %i. Otherwise, if the service cannot start by systemctl and the reshap progress would be stuck all time when grows array from raid1 to raid5.
reproduce steps:
./mdadm -CR/dev/md0-l1 -b internal -n2 /dev/loop[0-1] ./mdadm --grow/dev/md0-l5 -n3 -a/dev/loop2Signed-off-by Zhilong Liu <[email protected]>---
systemd/[email protected] | 2 +-1 file changed, 1 insertion(+), 1 deletion(-)systemd/[email protected] +0
-0@@ -10,7 +10,7 @@ Description=Manage MD Reshape on /dev/%IDefaultDependencies=no
[Service]
systemd/[email protected] Description=Manage MD Reshape on /dev/%I · line 13
Quoted 2 lines
systemd/[email protected] +1
-1-ExecStart=BINDIR/mdadm --grow --continue /dev/%I +ExecStart=BINDIR/mdadm --grow --continue /dev/%iDo you know why this makes a difference? I don't think it should. man systemd.unit says that "%i" is the "Instance name" while "%I" is the "Unescaped instance name".
The Instance name here is something like "md0" so there is nothing to escape.
Quoted 7 lines
Quoted 3 lines
I would rather not change it unless we know exactly why it is broken, and I don't find your explanation to be convincing.
Exactly, you're correct, in this case, %i and %I are the same. The root cause is the ExecStart part, all the path name should be verified by systemd-escape,such as:
/sbin/mdadmshould be corrected as sbin-mdadm, and /dev/%I should be -dev-%I. Thus I'm sorry for this patch, I do agree with you not to change it. And say sorry to Jes.
How about modifying this patch as:
ExecStart=-sbin-mdadm --grow --continue -dev-%I
Thanks,
Zhilong
Quoted 22 lines
Thanks
-zhilongQuoted 13 lines
NeilBrown
Quoted 10 lines
StandardInput=null
StandardOutput=null
StandardError=nullSignature · 6 lines
2.10.2 -- To unsubscribe from this list: send the line "unsubscribe linux-raid" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 49 lines · Zhilong
Send from iPhone
Quoted 47 lines · 在 2017年4月4日,13:07,Zhilong <[email protected]> 写道:
Send from iPhone
Quoted 40 lines
Quoted 27 lines · 在 2017年4月3日,12:36,NeilBrown <[email protected]> 写道:
On Thu, Mar 30 2017, Zhilong Liu wrote:
systemctl doesn't interpret [email protected] correctly due to the wrong argument provided in [service], it should be corrected %I as %i. Otherwise, if the service cannot start by systemctl and the reshap progress would be stuck all time when grows array from raid1 to raid5.
reproduce steps:
./mdadm -CR/dev/md0-l1 -b internal -n2 /dev/loop[0-1] ./mdadm --grow/dev/md0-l5 -n3 -a/dev/loop2Signed-off-by Zhilong Liu <[email protected]>---
systemd/[email protected] | 2 +-1 file changed, 1 insertion(+), 1 deletion(-)systemd/[email protected] +0
-0@@ -10,7 +10,7 @@ Description=Manage MD Reshape on /dev/%IDefaultDependencies=no
[Service]
systemd/[email protected] Description=Manage MD Reshape on /dev/%I · line 13
Quoted 2 lines
systemd/[email protected] +1
-1-ExecStart=BINDIR/mdadm --grow --continue /dev/%I +ExecStart=BINDIR/mdadm --grow --continue /dev/%iDo you know why this makes a difference? I don't think it should. man systemd.unit says that "%i" is the "Instance name" while "%I" is the "Unescaped instance name".
The Instance name here is something like "md0" so there is nothing to escape.
I would rather not change it unless we know exactly why it is broken, and I don't find your explanation to be convincing.
Quoted 8 lines
Quoted 3 lines
Exactly, you're correct, in this case, %i and %I are the same. The root cause is the ExecStart part, all the path name should be verified by systemd-escape,such as:
/sbin/mdadmshould be corrected as sbin-mdadm, and /dev/%I should be -dev-%I. Thus I'm sorry for this patch, I do agree with you not to change it. And say sorry to Jes.How about modifying this patch as:
ExecStart=-sbin-mdadm --grow --continue -dev-%I
Why do you think anything needs changing here?
I have a tumbleweed install with the standard
[email protected]
file. i.e.
ExecStart=/sbin/mdadm --grow --continue /dev/%I
I run
strace -f -s 1000 -p 1 -o /tmp/strace
in one window, then
systemctl start [email protected]
in another.
Then
grep execve /tmp/strace
shows:
18680 execve("/sbin/mdadm", ["/sbin/mdadm", "--grow", "--continue", "/dev/md0"], [/* 3 vars */] <unfinished ...>
which shows that mdadm is being correctly.
There is nothing to fix here that I can see.
NeilBrown
Quoted 86 lines · NeilBrown
Quoted 58 lines · Zhilong
Send from iPhone
Quoted 48 lines · 在 2017年4月4日,13:07,Zhilong <[email protected]> 写道:
Send from iPhone
Quoted 35 lines
Quoted 28 lines · 在 2017年4月3日,12:36,NeilBrown <[email protected]> 写道:
On Thu, Mar 30 2017, Zhilong Liu wrote:
systemctl doesn't interpret [email protected] correctly due to the wrong argument provided in [service], it should be corrected %I as %i. Otherwise, if the service cannot start by systemctl and the reshap progress would be stuck all time when grows array from raid1 to raid5.
reproduce steps:
./mdadm -CR/dev/md0-l1 -b internal -n2 /dev/loop[0-1] ./mdadm --grow/dev/md0-l5 -n3 -a/dev/loop2Signed-off-by Zhilong Liu <[email protected]>---
systemd/[email protected] | 2 +-1 file changed, 1 insertion(+), 1 deletion(-)systemd/[email protected] +0
-0@@ -10,7 +10,7 @@ Description=Manage MD Reshape on /dev/%IDefaultDependencies=no
[Service]
systemd/[email protected] Description=Manage MD Reshape on /dev/%I · line 13
Quoted 2 lines
systemd/[email protected] +1
-1-ExecStart=BINDIR/mdadm --grow --continue /dev/%I +ExecStart=BINDIR/mdadm --grow --continue /dev/%iDo you know why this makes a difference? I don't think it should. man systemd.unit says that "%i" is the "Instance name" while "%I" is the "Unescaped instance name".
Quoted 6 lines
The Instance name here is something like "md0" so there is nothing to escape.
I would rather not change it unless we know exactly why it is broken, and I don't find your explanation to be convincing.
Quoted 7 lines
Exactly, you're correct, in this case, %i and %I are the same. The root cause is the ExecStart part, all the path name should be verified by systemd-escape,such as:
/sbin/mdadmshould be corrected as sbin-mdadm, and /dev/%I should be -dev-%I. Thus I'm sorry for this patch, I do agree with you not to change it. And say sorry to Jes.Quoted 4 lines
How about modifying this patch as:
ExecStart=-sbin-mdadm --grow --continue -dev-%I
Why do you think anything needs changing here?
I have a tumbleweed install with the standard
[email protected]
file. i.e.ExecStart=/sbin/mdadm --grow --continue /dev/%II run
strace -f -s 1000 -p 1 -o/tmp/stracein one window, then
systemctl start [email protected]
in another.
Then
grep execve
/tmp/strace
Quoted 7 lines
shows:
18680 execve("/sbin/mdadm", ["
/sbin/mdadm", "--grow", "--continue", "/dev/md0"], [/* 3 vars */] <unfinished ...>which shows that mdadm is being correctly.
There is nothing to fix here that I can see.
Unless I see some convincing arguments, I am going to revert this patch.
Jes