[v3] mdadm:fix mdmonitor.service

Submitted by Zang Ruochen on July 31, 2019, 1:50 a.m. | Patch ID: 163518

Details

Message ID 20190731015020.21434-1-zangrc.fnst@cn.fujitsu.com
State New
Headers show

Commit Message

Zang Ruochen July 31, 2019, 1:50 a.m.
-The original file mdmonitor.service is as follows:
...
|[Service]
|Environment=  MDADM_MONITOR_ARGS=--scan
|EnvironmentFile=-/run/sysconfig/mdadm
|ExecStartPre=-/usr/lib/mdadm/mdadm_env.sh
|ExecStart=/sbin/mdadm --monitor -y $MDADM_MONITOR_ARGS
...
-It has a syntax error and it doesn't work properly,
 so add files/0001-Fix-file-mdmonitor.service-syntax-error.patch to fix it.

Signed-off-by: Zang Ruochen <zangrc.fnst@cn.fujitsu.com>
---
 ...-file-mdmonitor.service-syntax-error.patch | 49 +++++++++++++++++++
 meta/recipes-extended/mdadm/mdadm_4.1.bb      |  1 +
 2 files changed, 50 insertions(+)
 create mode 100644 meta/recipes-extended/mdadm/files/0001-Fix-file-mdmonitor.service-syntax-error.patch

Patch hide | download patch | download mbox

diff --git a/meta/recipes-extended/mdadm/files/0001-Fix-file-mdmonitor.service-syntax-error.patch b/meta/recipes-extended/mdadm/files/0001-Fix-file-mdmonitor.service-syntax-error.patch
new file mode 100644
index 0000000000..a36fed6f9f
--- /dev/null
+++ b/meta/recipes-extended/mdadm/files/0001-Fix-file-mdmonitor.service-syntax-error.patch
@@ -0,0 +1,49 @@ 
+From a4a37cc9d91d7129910360914b8b2060139c0307 Mon Sep 17 00:00:00 2001
+From: Zang Ruochen <zangrc.fnst@cn.fujitsu.com>
+Date: Tue, 30 Jul 2019 12:44:25 +0800
+Subject: [PATCH] Fix file mdmonitor.service syntax error
+
+-The original file mdmonitor.service is as follows:
+...
+|[Service]
+|Environment=  MDADM_MONITOR_ARGS=--scan
+|EnvironmentFile=-/run/sysconfig/mdadm
+|ExecStartPre=-/usr/lib/mdadm/mdadm_env.sh
+|ExecStart=/sbin/mdadm --monitor -y $MDADM_MONITOR_ARGS
+...
+-It has a syntax error and it doesn't work properly, 
+ so add new file mdmonitor.service to overwrite it.
+
+Signed-off-by: Zang Ruochen <zangrc.fnst@cn.fujitsu.com>
+---
+ systemd/mdmonitor.service | 15 +++++++++------
+ 1 file changed, 9 insertions(+), 6 deletions(-)
+
+diff --git a/systemd/mdmonitor.service b/systemd/mdmonitor.service
+index 3fc4687..bd243b4 100644
+--- a/systemd/mdmonitor.service
++++ b/systemd/mdmonitor.service
+@@ -6,11 +6,14 @@
+ #  (at your option) any later version.
+ 
+ [Unit]
+-Description=MD array monitor
+-DefaultDependencies=no
++Description=Software RAID monitoring and management
++ConditionPathExists=/etc/mdadm.conf
+ 
+ [Service]
+-Environment=  MDADM_MONITOR_ARGS=--scan
+-EnvironmentFile=-/run/sysconfig/mdadm
+-ExecStartPre=-/usr/lib/mdadm/mdadm_env.sh
+-ExecStart=BINDIR/mdadm --monitor -y $MDADM_MONITOR_ARGS
++Type=forking
++PIDFile=/var/run/mdadm/mdadm.pid
++EnvironmentFile=-/etc/sysconfig/mdmonitor
++ExecStart=/sbin/mdadm --monitor --scan -y -f --pid-file=/var/run/mdadm/mdadm.pid
++
++[Install]
++WantedBy=multi-user.target
+-- 
+2.20.1
+
diff --git a/meta/recipes-extended/mdadm/mdadm_4.1.bb b/meta/recipes-extended/mdadm/mdadm_4.1.bb
index 74c94f6ecb..c3e15adc71 100644
--- a/meta/recipes-extended/mdadm/mdadm_4.1.bb
+++ b/meta/recipes-extended/mdadm/mdadm_4.1.bb
@@ -22,6 +22,7 @@  SRC_URI = "${KERNELORG_MIRROR}/linux/utils/raid/mdadm/${BPN}-${PV}.tar.xz \
 	   file://mdadm.init \
 	   file://0001-mdadm-add-option-y-for-use-syslog-to-recive-event-re.patch \
            file://include_sysmacros.patch \
+           file://0001-Fix-file-mdmonitor.service-syntax-error.patch \
            "
 SRC_URI[md5sum] = "51bf3651bd73a06c413a2f964f299598"
 SRC_URI[sha256sum] = "ab7688842908d3583a704d491956f31324c3a5fc9f6a04653cb75d19f1934f4a"

Comments

Qi.Chen@windriver.com July 31, 2019, 2:50 a.m.
On 07/31/2019 09:50 AM, Zang Ruochen wrote:
> -The original file mdmonitor.service is as follows:
> ...
> |[Service]
> |Environment=  MDADM_MONITOR_ARGS=--scan
> |EnvironmentFile=-/run/sysconfig/mdadm
> |ExecStartPre=-/usr/lib/mdadm/mdadm_env.sh
> |ExecStart=/sbin/mdadm --monitor -y $MDADM_MONITOR_ARGS
> ...
> -It has a syntax error and it doesn't work properly,

What is the actual syntax error? Why does it not work properly?

>   so add files/0001-Fix-file-mdmonitor.service-syntax-error.patch to fix it.
>
> Signed-off-by: Zang Ruochen <zangrc.fnst@cn.fujitsu.com>
> ---
>   ...-file-mdmonitor.service-syntax-error.patch | 49 +++++++++++++++++++
>   meta/recipes-extended/mdadm/mdadm_4.1.bb      |  1 +
>   2 files changed, 50 insertions(+)
>   create mode 100644 meta/recipes-extended/mdadm/files/0001-Fix-file-mdmonitor.service-syntax-error.patch
>
> diff --git a/meta/recipes-extended/mdadm/files/0001-Fix-file-mdmonitor.service-syntax-error.patch b/meta/recipes-extended/mdadm/files/0001-Fix-file-mdmonitor.service-syntax-error.patch
> new file mode 100644
> index 0000000000..a36fed6f9f
> --- /dev/null
> +++ b/meta/recipes-extended/mdadm/files/0001-Fix-file-mdmonitor.service-syntax-error.patch
> @@ -0,0 +1,49 @@
> +From a4a37cc9d91d7129910360914b8b2060139c0307 Mon Sep 17 00:00:00 2001
> +From: Zang Ruochen <zangrc.fnst@cn.fujitsu.com>
> +Date: Tue, 30 Jul 2019 12:44:25 +0800
> +Subject: [PATCH] Fix file mdmonitor.service syntax error
> +
> +-The original file mdmonitor.service is as follows:
> +...
> +|[Service]
> +|Environment=  MDADM_MONITOR_ARGS=--scan
> +|EnvironmentFile=-/run/sysconfig/mdadm
> +|ExecStartPre=-/usr/lib/mdadm/mdadm_env.sh
> +|ExecStart=/sbin/mdadm --monitor -y $MDADM_MONITOR_ARGS
> +...
> +-It has a syntax error and it doesn't work properly,
> + so add new file mdmonitor.service to overwrite it.
> +
> +Signed-off-by: Zang Ruochen <zangrc.fnst@cn.fujitsu.com>
> +---
> + systemd/mdmonitor.service | 15 +++++++++------
> + 1 file changed, 9 insertions(+), 6 deletions(-)
> +
> +diff --git a/systemd/mdmonitor.service b/systemd/mdmonitor.service
> +index 3fc4687..bd243b4 100644
> +--- a/systemd/mdmonitor.service
> ++++ b/systemd/mdmonitor.service
> +@@ -6,11 +6,14 @@
> + #  (at your option) any later version.
> +
> + [Unit]
> +-Description=MD array monitor
> +-DefaultDependencies=no
> ++Description=Software RAID monitoring and management
> ++ConditionPathExists=/etc/mdadm.conf

Why do above changes? Also, isn't /etc/mdadm.conf always there?

> +
> + [Service]
> +-Environment=  MDADM_MONITOR_ARGS=--scan
> +-EnvironmentFile=-/run/sysconfig/mdadm
> +-ExecStartPre=-/usr/lib/mdadm/mdadm_env.sh
> +-ExecStart=BINDIR/mdadm --monitor -y $MDADM_MONITOR_ARGS
> ++Type=forking
> ++PIDFile=/var/run/mdadm/mdadm.pid

Type=forking is not encouraged. Is there any reason we want to use it?
Also, PIDFile is recommended to locate under /run instead of /var/run. 
systemd actually automatically modifies the configuration to change 
/var/run to /run.

Regards,
Chen Qi

> ++EnvironmentFile=-/etc/sysconfig/mdmonitor
> ++ExecStart=/sbin/mdadm --monitor --scan -y -f --pid-file=/var/run/mdadm/mdadm.pid
> ++
> ++[Install]
> ++WantedBy=multi-user.target
> +--
> +2.20.1
> +
> diff --git a/meta/recipes-extended/mdadm/mdadm_4.1.bb b/meta/recipes-extended/mdadm/mdadm_4.1.bb
> index 74c94f6ecb..c3e15adc71 100644
> --- a/meta/recipes-extended/mdadm/mdadm_4.1.bb
> +++ b/meta/recipes-extended/mdadm/mdadm_4.1.bb
> @@ -22,6 +22,7 @@ SRC_URI = "${KERNELORG_MIRROR}/linux/utils/raid/mdadm/${BPN}-${PV}.tar.xz \
>   	   file://mdadm.init \
>   	   file://0001-mdadm-add-option-y-for-use-syslog-to-recive-event-re.patch \
>              file://include_sysmacros.patch \
> +           file://0001-Fix-file-mdmonitor.service-syntax-error.patch \
>              "
>   SRC_URI[md5sum] = "51bf3651bd73a06c413a2f964f299598"
>   SRC_URI[sha256sum] = "ab7688842908d3583a704d491956f31324c3a5fc9f6a04653cb75d19f1934f4a"