Monitor: print message before quit for no array to monitor
PATCH v2 1/1 Monitor: print message before quit for no array to monitor
If there is no array device to monitor, Monitor() will stop monitoring at line 261 from the following code block,
257 if (!new_found) {
258 if (oneshot)
259 break;
260 else if (!anyredundant) {
261 break;
262 }
This change was introduced by commit 007087d0898a ("Monitor: stop notifing about containers"). Before this commit, Monitor() will continue and won't quit even there is no array to monitor.
It is fine to quit without any array device to monitor, but users may wonder whether there is something wrong with mdadm program or their configuration to make mdadm quit monitoring.
This patch adds a simple error message to indicate Monitor() quits for array device to monitor, which makes users have hint to understand why mdadm stops monitoring.
---
Changelog:
v2: add CC to Jes, and fix typo.
v1: the original version.
Monitor.c | 1 + 1 file changed, 1 insertion(+)
Monitor.c +1 -0
@@ -258,6 +258,7 @@ int Monitor(struct mddev_dev *devlist,if (oneshot)break ;else if (!anyredundant) { +pr_err ("Stop for no array to monitor\n" );break ; }else {
Signature · 1 line
2.31.1
Hi Coly,
Monitor.c int Monitor(struct mddev_dev *devlist, · line 262
Quoted 6 lines · Coly Li
Monitor.c +1
-0@@ -258,6 +258,7 @@ int Monitor(struct mddev_dev *devlist,if (oneshot)break ;else if (!anyredundant) { +pr_err ("Stop for no array to monitor\n" );break ;
IMO the message is not precise enough. See that if there is only raid0 then it also stops. Something like:
"No array with redundancy detected, stopping" is more detailed.
Thanks,
Mariusz
Quoted 12 lines · Mariusz
Hi Coly,
Monitor.c int Monitor(struct mddev_dev *devlist, · line 262
Quoted 6 lines · Coly Li
Monitor.c +1
-0@@ -258,6 +258,7 @@ int Monitor(struct mddev_dev *devlist, if (oneshot) break; else if (!anyredundant) { + pr_err("Stop for no array to monitor\n"); break;IMO the message is not precise enough. See that if there is only raid0 then it also stops. Something like:
"No array with redundancy detected, stopping" is more detailed.
Copied. I will post v3 patch with your suggestion.
Thanks.
Coly Li