Message ID | 20181005000057.30186-2-vishal.l.verma@intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [ndctl,1/2] ndctl, monitor: fix the severity of the "daemon started" message | expand |
On Thu, 2018-10-04 at 18:00 -0600, Vishal Verma wrote: > 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. > > Link: https://bugs.launchpad.net/ubuntu/+source/ndctl/+bug/1781268 > Reported-by: Andreas Hasenack <andreas@canonical.com> > Cc: Dan Williams <dan.j.williams@intel.com> Looks good to me, if no one is sticking around to reap the error might as well claim success. Reviewed-by: Dan Williams <dan.j.williams@intel.com>
> -----Original Message----- > From: Vishal Verma [mailto:vishal.l.verma@intel.com] > Sent: Friday, October 5, 2018 9:01 AM > To: linux-nvdimm@lists.01.org > Cc: Qi, Fuli/斉 福利 <qi.fuli@jp.fujitsu.com>; Andreas Hasenack > <andreas@canonical.com>; Vishal Verma <vishal.l.verma@intel.com>; Dan > Williams <dan.j.williams@intel.com> > 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. > > Link: https://bugs.launchpad.net/ubuntu/+source/ndctl/+bug/1781268 > Reported-by: Andreas Hasenack <andreas@canonical.com> > Cc: Dan Williams <dan.j.williams@intel.com> > Cc: QI Fuli <qi.fuli@jp.fujitsu.com> > Signed-off-by: Vishal Verma <vishal.l.verma@intel.com> > --- > ndctl/monitor.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/ndctl/monitor.c b/ndctl/monitor.c index b44f946..7bf2ba7 100644 > --- a/ndctl/monitor.c > +++ b/ndctl/monitor.c > @@ -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; > } > > -- > 2.17.1 > Looks good to me. Thank you very much, QI Fuli
diff --git a/ndctl/monitor.c b/ndctl/monitor.c index b44f946..7bf2ba7 100644 --- a/ndctl/monitor.c +++ b/ndctl/monitor.c @@ -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; }
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. Link: https://bugs.launchpad.net/ubuntu/+source/ndctl/+bug/1781268 Reported-by: Andreas Hasenack <andreas@canonical.com> Cc: Dan Williams <dan.j.williams@intel.com> Cc: QI Fuli <qi.fuli@jp.fujitsu.com> Signed-off-by: Vishal Verma <vishal.l.verma@intel.com> --- ndctl/monitor.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)