zfs/cmd/zed
наб 3e04897edc zed: implement close_from() in terms of /proc/self/fd, if available
/dev/fd on Darwin

Consider the following strace output:
  prlimit64(0, RLIMIT_NOFILE, NULL, {rlim_cur=1024, rlim_max=1024*1024}) = 0

Yes, that is well over a million file descriptors!

This reduces the ZED start-up time from "at least a second" to
"instantaneous", and, under strace, from "don't even try" to "usable"
by simple virtue of doing five syscalls instead of over a million;
in most cases the main loop does nothing

Recent Linuxes (5.8+) have close_range(2) for this, but that's an
overoptimisation (and libcs don't have wrappers for it yet)

This is also run by the ZEDLET pre-exec. Compare:
  Finished "all-syslog.sh" eid=13 pid=6717 time=1.027100s exit=0
  Finished "history_event-zfs-list-cacher.sh" eid=13 pid=6718 time=1.046923s exit=0
to
  Finished "all-syslog.sh" eid=12 pid=4834 time=0.001836s exit=0
  Finished "history_event-zfs-list-cacher.sh" eid=12 pid=4835 time=0.001346s exit=0
lol

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #11834
2021-11-12 15:24:36 -08:00
..
agents FreeBSD: notify userspace when a vdev is removed 2020-12-23 13:08:12 -08:00
zed.d ZED/zfs-list-cacher.sh: don't exit on ignored event type 2020-12-19 18:01:21 -08:00
.gitignore Initial implementation of zed (ZFS Event Daemon) 2014-04-02 13:10:03 -07:00
Makefile.am cppcheck: integrete cppcheck 2021-06-23 13:22:15 -07:00
zed.c Replace ZFS on Linux references with OpenZFS 2020-10-16 13:01:24 -07:00
zed.h Replace ZFS on Linux references with OpenZFS 2020-10-16 13:01:24 -07:00
zed_conf.c Replace ZFS on Linux references with OpenZFS 2020-10-16 13:01:24 -07:00
zed_conf.h Replace ZFS on Linux references with OpenZFS 2020-10-16 13:01:24 -07:00
zed_disk_event.c Add libzutil for libzfs or libzpool consumers 2018-11-05 11:22:33 -08:00
zed_disk_event.h Bring over illumos ZFS FMA logic -- phase 1 2016-09-01 11:39:45 -07:00
zed_event.c Replace ZFS on Linux references with OpenZFS 2020-10-16 13:01:24 -07:00
zed_event.h Replace ZFS on Linux references with OpenZFS 2020-10-16 13:01:24 -07:00
zed_exec.c zed: reap child after killing on time-out 2021-06-23 13:22:15 -07:00
zed_exec.h Replace ZFS on Linux references with OpenZFS 2020-10-16 13:01:24 -07:00
zed_file.c zed: implement close_from() in terms of /proc/self/fd, if available 2021-11-12 15:24:36 -08:00
zed_file.h Replace ZFS on Linux references with OpenZFS 2020-10-16 13:01:24 -07:00
zed_log.c Replace ZFS on Linux references with OpenZFS 2020-10-16 13:01:24 -07:00
zed_log.h Replace ZFS on Linux references with OpenZFS 2020-10-16 13:01:24 -07:00
zed_strings.c Replace ZFS on Linux references with OpenZFS 2020-10-16 13:01:24 -07:00
zed_strings.h Replace ZFS on Linux references with OpenZFS 2020-10-16 13:01:24 -07:00