Skip to contentSkip to conversation

ndctl, monitor: fix the severity of the "daemon started" message

PATCH In review Vishal Verma 4 participants 9 messages Oct 5, 2018 1 message not in the archive libnvdimm: non-volatile memory device

lore
Share & tools
lore

Vishal Verma

author maintainer
#0 lore raw

PATCH 1/2 ndctl, monitor: fix the severity of the "daemon started" message

The above message was printed as an error, but it is just an informational message. Change it to dbg().

---
 ndctl/monitor.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
ndctl/monitor.c +1 -1
index d29e378..b44f946 100644
@@ -660,7 +660,7 @@ int cmd_monitor(int argc, const char **argv, void *ctx)
 			err((struct ndctl_ctx *)ctx, "daemon start failed\n");
 			goto out;
 		}
-		err((struct ndctl_ctx *)ctx, "ndctl monitor daemon started\n");
+		dbg((struct ndctl_ctx *)ctx, "ndctl monitor daemon started\n");
 	}
 
 	if (parse_monitor_event(&monitor, (struct ndctl_ctx *)ctx))
Signature · 6 lines
2.17.1

_______________________________________________
Linux-nvdimm mailing list
[email protected]
https://lists.01.org/mailman/listinfo/linux-nvdimm
author maintainer
#1 lore raw

PATCH 2/2 ndctl, monitor: in daemon mode, exit successfully if no DIMMs are found

When we are running as a daemon, it is preferred to exit successfully when no DIMMs are found. When running in the foreground, retain an error return so that the user can be notified that nothing was found to monitor.

In the longer term, replace this with a libudev uevent monitor that will look for DIMM addition/removal events, and update the running monitor(s) if the DIMMs match the active filter spec.

---
 ndctl/monitor.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
ndctl/monitor.c +3 -2
index b44f946..7bf2ba7 100644
@@ -681,8 +681,9 @@ int cmd_monitor(int argc, const char **argv, void *ctx)
 		goto out;
 
 	if (!mfa.num_dimm) {
-		err((struct ndctl_ctx *)ctx, "no dimms to monitor\n");
-		rc = -ENXIO;
+		dbg((struct ndctl_ctx *)ctx, "no dimms to monitor\n");
+		if (!monitor.daemon)
+			rc = -ENXIO;
 		goto out;
 	}
 
Signature · 6 lines
2.17.1

_______________________________________________
Linux-nvdimm mailing list
[email protected]
https://lists.01.org/mailman/listinfo/linux-nvdimm
Reviewed-by on v1 2/2
#2 lore raw

Re: [ndctl PATCH 2/2] ndctl, monitor: in daemon mode, exit successfully if no DIMMs are found

Quoted 12 lines · Vishal Verma

When we are running as a daemon, it is preferred to exit successfully when no DIMMs are found. When running in the foreground, retain an error
return so that the user can be notified that nothing was found to monitor.

In the longer term, replace this with a libudev uevent monitor that will
look for DIMM addition/removal events, and update the running monitor(s)
if the DIMMs match the active filter spec.

Quoted 3 lines

Looks good to me, if no one is sticking around to reap the error might as well claim success.

_______________________________________________
Linux-nvdimm mailing list
[email protected]
https://lists.01.org/mailman/listinfo/linux-nvdimm

#3 lore raw

RE: [ndctl PATCH 2/2] ndctl, monitor: in daemon mode, exit successfully if no DIMMs are found

In reply to Vishal Verma
Quoted 43 lines

-----Original Message-----
From: Vishal Verma [mailto:[email protected]]
Sent: Friday, October 5, 2018 9:01 AM
To: [email protected]
Cc: Qi, Fuli/斉 福利 <[email protected]>; Andreas Hasenack <[email protected]>; Vishal Verma <[email protected]>; Dan Williams <[email protected]>
Subject: [ndctl PATCH 2/2] ndctl, monitor: in daemon mode, exit successfully if no DIMMs are found

When we are running as a daemon, it is preferred to exit successfully when no DIMMs are found. When running in the foreground, retain an error return so that the user can be notified that nothing was found to monitor.

In the longer term, replace this with a libudev uevent monitor that will look for DIMM addition/removal events, and update the running monitor(s) if the DIMMs match the active filter spec.

---
 ndctl/monitor.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
ndctl/monitor.c +3 -3
@@ -681,8 +681,9 @@ int cmd_monitor(int argc, const char **argv, void *ctx)
 		goto out;
 
 	if (!mfa.num_dimm) {
-		err((struct ndctl_ctx *)ctx, "no dimms to monitor\n");
-		rc = -ENXIO;
+		dbg((struct ndctl_ctx *)ctx, "no dimms to monitor\n");
+		if (!monitor.daemon)
+			rc = -ENXIO;
 		goto out;
 	}
 
--
Quoted 2 lines

2.17.1

Looks good to me.

Thank you very much,
QI Fuli

_______________________________________________
Linux-nvdimm mailing list
[email protected]
https://lists.01.org/mailman/listinfo/linux-nvdimm

#5 lore raw
In reply to Vishal Verma

Hi, Vishal-san,

Quoted 2 lines

The above message was printed as an error, but it is just an informational message. Change it to dbg().

Hmmmmmmm.

When I was a engineer for trouble-shooting of customer's Linux system, the starting time and the ending time of any daemon was very helpful for investigating their trouble.

So, I think it is not only for developer, but also it is essential for trouble-shooter for custmer support.
(It may be also same with system operator)

Quoted 13 lines
---
 ndctl/monitor.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
ndctl/monitor.c +0 -0
index d29e378..b44f946 100644

ndctl/monitor.c int cmd_monitor(int argc, const char **argv, void *ctx) · line 663

Quoted 5 lines
ndctl/monitor.c +1 -1
@@ -660,7 +660,7 @@ int cmd_monitor(int argc, const char **argv, void *ctx)
 			err((struct ndctl_ctx *)ctx, "daemon start failed\n");
 			goto out;
 		}
-		err((struct ndctl_ctx *)ctx, "ndctl monitor daemon started\n");
+		dbg((struct ndctl_ctx *)ctx, "ndctl monitor daemon started\n");

Though I agree its message is not "error" certainly, I would like to keep it as normal status level message.

Thanks,
---
Yasunori Goto

_______________________________________________
Linux-nvdimm mailing list
[email protected]
https://lists.01.org/mailman/listinfo/linux-nvdimm

#6 lore raw
Quoted 25 lines · Yasunori Goto

Hi, Vishal-san,

Quoted 2 lines

The above message was printed as an error, but it is just an informational message. Change it to dbg().

Hmmmmmmm.

When I was a engineer for trouble-shooting of customer's Linux system, the starting time and the ending time of any daemon was very helpful for investigating their trouble.

So, I think it is not only for developer, but also it is essential for trouble-shooter for custmer support.
(It may be also same with system operator)

Quoted 8 lines
---
 ndctl/monitor.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 14 lines

ndctl/monitor.c int cmd_monitor(int argc, const char **argv, void *ctx) · line 663

Quoted 10 lines
ndctl/monitor.c +1 -1
index d29e378..b44f946 100644
@@ -660,7 +660,7 @@ int cmd_monitor(int argc, const char **argv, void *ctx)
                      err((struct ndctl_ctx *)ctx, "daemon start failed\n");
                      goto out;
              }
-             err((struct ndctl_ctx *)ctx, "ndctl monitor daemon started\n");
+             dbg((struct ndctl_ctx *)ctx, "ndctl monitor daemon started\n");

Though I agree its message is not "error" certainly, I would like to keep it as normal status level message.

Sounds good to me.
_______________________________________________
Linux-nvdimm mailing list
[email protected]
https://lists.01.org/mailman/listinfo/linux-nvdimm

#7 lore raw
Quoted 51 lines

-----Original Message-----
From: Linux-nvdimm [mailto:[email protected]] On Behalf Of Dan Williams
Sent: Friday, October 5, 2018 1:24 PM
To: Gotou, Yasunori/五島 康文 <[email protected]>
Cc: [email protected]; linux-nvdimm <[email protected]>
Subject: Re: [ndctl PATCH 1/2] ndctl, monitor: fix the severity of the "daemon started" message

Quoted 25 lines · Yasunori Goto

Hi, Vishal-san,

Quoted 2 lines

The above message was printed as an error, but it is just an informational message. Change it to dbg().

Hmmmmmmm.

When I was a engineer for trouble-shooting of customer's Linux system, the starting time and the ending time of any daemon was very helpful for investigating their trouble.

So, I think it is not only for developer, but also it is essential for trouble-shooter for custmer support.
(It may be also same with system operator)

Quoted 8 lines
---
 ndctl/monitor.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 15 lines

ndctl/monitor.c int cmd_monitor(int argc, const char **argv, void *ctx) · line 664

Quoted 11 lines
ndctl/monitor.c index renamed from ndctl/monitor.c +0 -0

d29e378..b44f946 100644

ndctl/monitor.c +2 -1
@@ -660,7 +660,7 @@ int cmd_monitor(int argc, const char **argv, void *ctx)
                      err((struct ndctl_ctx *)ctx, "daemon start failed\n");
                      goto out;
              }
-             err((struct ndctl_ctx *)ctx, "ndctl monitor daemon started\n");
+             dbg((struct ndctl_ctx *)ctx, "ndctl monitor daemon
+ started\n");

Though I agree its message is not "error" certainly, I would like to keep it as normal status level message.

Quoted 1 line

Sounds good to me.

In my original idea, I just wanted to log the "daemon started" message.
After thinking more about it, I agree that the message is not at "error" level.
However, considering this message will be helpful for some users like system operators,
how about changing this message level to "info" and meanwhile changing the default log level to "LOG_INFO" as following?

ndctl/monitor.c +2 -2
index d29e378..10866b6 100644
@@ -628,7 +628,7 @@ int cmd_monitor(int argc, const char **argv, void *ctx)
        if (monitor.verbose)
                ndctl_set_log_priority((struct ndctl_ctx *)ctx, LOG_DEBUG);
        else
-               ndctl_set_log_priority((struct ndctl_ctx *)ctx, LOG_NOTICE);
+               ndctl_set_log_priority((struct ndctl_ctx *)ctx, LOG_INFO);
 
        rc = read_config_file((struct ndctl_ctx *)ctx, &monitor, &param);
        if (rc)
@@ -657,7 +657,7 @@ int cmd_monitor(int argc, const char **argv, void *ctx)
                if (!monitor.log || strncmp(monitor.log, "./", 2) == 0)
                        ndctl_set_log_fn((struct ndctl_ctx *)ctx, log_syslog);
                if (daemon(0, 0) != 0) {
-                       err((struct ndctl_ctx *)ctx, "daemon start failed\n");
+                       info((struct ndctl_ctx *)ctx, "daemon start failed\n");
                        goto out;
                }
                err((struct ndctl_ctx *)ctx, "ndctl monitor daemon started\n");

Thank you very much,
QI Fuli

Quoted 4 lines

_______________________________________________
Linux-nvdimm mailing list
[email protected]
https://lists.01.org/mailman/listinfo/linux-nvdimm

_______________________________________________
Linux-nvdimm mailing list
[email protected]
https://lists.01.org/mailman/listinfo/linux-nvdimm

A message that is not in the archive (sent off-list or not yet received): [email protected]

#9 lore raw
Quoted 37 lines
Quoted 7 lines
Quoted 3 lines
Quoted 1 line

Sounds good to me.

In my original idea, I just wanted to log the "daemon started" message. After thinking more about it, I agree that the message is not at "error" level. However, considering this message will be helpful for some users like system

operators,

Quoted 1 line

how about changing this message level to "info" and meanwhile changing the

default log level to "LOG_INFO" as following?

Quoted 15 lines
ndctl/monitor.c +1 -1
index d29e378..10866b6 100644
@@ -628,7 +628,7 @@ int cmd_monitor(int argc, const char **argv, void *ctx)
        if (monitor.verbose)
                ndctl_set_log_priority((struct ndctl_ctx *)ctx, LOG_DEBUG);
        else
-               ndctl_set_log_priority((struct ndctl_ctx *)ctx, LOG_NOTICE);
+               ndctl_set_log_priority((struct ndctl_ctx *)ctx, LOG_INFO);
 
        rc = read_config_file((struct ndctl_ctx *)ctx, &monitor, &param);
        if (rc)

ndctl/monitor.c int cmd_monitor(int argc, const char **argv, void *ctx) · line 663

Quoted 8 lines
ndctl/monitor.c +1 -1
@@ -657,7 +657,7 @@ int cmd_monitor(int argc, const char **argv, void *ctx)
                if (!monitor.log || strncmp(monitor.log, "./", 2) == 0)
                        ndctl_set_log_fn((struct ndctl_ctx *)ctx, log_syslog);
                if (daemon(0, 0) != 0) {
-                       err((struct ndctl_ctx *)ctx, "daemon start failed\n");
+                       info((struct ndctl_ctx *)ctx, "daemon start failed\n");
                        goto out;
                }
                err((struct ndctl_ctx *)ctx, "ndctl monitor daemon started\n");

Yes, this looks good to me. Will you send a proper patch for this, and I can replace my patch with yours.

Quoted 3 lines

Thanks,
-Vishal

Ok, I will send a patch.

Quoted 9 lines
Quoted 9 lines

Thank you very much,
QI Fuli

Quoted 4 lines

_______________________________________________
Linux-nvdimm mailing list
[email protected]
https://lists.01.org/mailman/listinfo/linux-nvdimm

_______________________________________________
Linux-nvdimm mailing list
[email protected]
https://lists.01.org/mailman/listinfo/linux-nvdimm