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 <[email protected]> Cc: Dan Williams <[email protected]> Cc: QI Fuli <[email protected]> Signed-off-by: Vishal Verma <[email protected]> --- 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 _______________________________________________ Linux-nvdimm mailing list [email protected] https://lists.01.org/mailman/listinfo/linux-nvdimm
