Skip to content

Commit

Permalink
ndctl, monitor: in daemon mode, exit successfully if no DIMMs are found
Browse files Browse the repository at this point in the history
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]>
Reviewed-by: Dan Williams <[email protected]>
Signed-off-by: Vishal Verma <[email protected]>
  • Loading branch information
stellarhopper committed Oct 5, 2018
1 parent b66a540 commit 52a4d38
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions ndctl/monitor.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit 52a4d38

Please sign in to comment.