aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/zed/zed_conf.c
diff options
context:
space:
mode:
authorJorgen Lundman <[email protected]>2020-06-23 01:53:34 +0900
committerGitHub <[email protected]>2020-06-22 09:53:34 -0700
commit68301ba20e0a6543304a63d22b558fddea130d79 (patch)
tree43957064dfa3f0f3571fc73878d76cf37620bd86 /cmd/zed/zed_conf.c
parent42d8d1d66ac1d3629ab22f65cd0787933cfb60ab (diff)
zed additional features
This commit adds two features to zed, that macOS desires. The first is that when you unload the kernel module, zed would enter into a cpubusy loop calling zfs_events_next() repeatedly. We now look for ENODEV, returned by kernel, so zed can exit gracefully. Second feature is -I (idle) (alas -P persist was taken) is for the deamon to; 1; if started without ZFS kernel module, stick around waiting for it. 2; if kernel module is unloaded, go back to 1. This is due to daemons in macOS is started by launchctl, and is expected to stick around. Currently, the busy loop only exists when errno is ENODEV. This is to ensure that functionality that upstream expects is not changed. It did not care about errors before, and it still does not. (with the exception of ENODEV). However, it is probably better that all errors (ERESTART notwithstanding) exits the loop, and the issues complaining about zed taking all CPU will go away. Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Jorgen Lundman <[email protected]> Closes #10476
Diffstat (limited to 'cmd/zed/zed_conf.c')
-rw-r--r--cmd/zed/zed_conf.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/cmd/zed/zed_conf.c b/cmd/zed/zed_conf.c
index 86671369c..52370eb87 100644
--- a/cmd/zed/zed_conf.c
+++ b/cmd/zed/zed_conf.c
@@ -153,6 +153,8 @@ _zed_conf_display_help(const char *prog, int got_err)
"Force daemon to run.");
fprintf(fp, "%*c%*s %s\n", w1, 0x20, -w2, "-F",
"Run daemon in the foreground.");
+ fprintf(fp, "%*c%*s %s\n", w1, 0x20, -w2, "-I",
+ "Idle daemon until kernel module is (re)loaded.");
fprintf(fp, "%*c%*s %s\n", w1, 0x20, -w2, "-M",
"Lock all pages in memory.");
fprintf(fp, "%*c%*s %s\n", w1, 0x20, -w2, "-P",
@@ -249,7 +251,7 @@ _zed_conf_parse_path(char **resultp, const char *path)
void
zed_conf_parse_opts(struct zed_conf *zcp, int argc, char **argv)
{
- const char * const opts = ":hLVc:d:p:P:s:vfFMZ";
+ const char * const opts = ":hLVc:d:p:P:s:vfFMZI";
int opt;
if (!zcp || !argv || !argv[0])
@@ -274,6 +276,9 @@ zed_conf_parse_opts(struct zed_conf *zcp, int argc, char **argv)
case 'd':
_zed_conf_parse_path(&zcp->zedlet_dir, optarg);
break;
+ case 'I':
+ zcp->do_idle = 1;
+ break;
case 'p':
_zed_conf_parse_path(&zcp->pid_file, optarg);
break;