mirror_zfs/cmd
наб f9bece92e2
zed: protect against wait4()/fork() races to the launched process tree
As soon as wait4() returns, fork() can immediately return with the same
PID, and race to lock _launched_processes_lock, then try to add the new
(duplicate) PID to _launched_processes, which asserts

By locking before wait4(), we ensure, that, given that same
unfortunate scheduling, _launched_processes_lock cannot be locked by the
spawner before we pop the process in the reaper, and only afterward will
it be added

This moves where the reaper idles when there are children from the
wait4() to the pause(), locking for the duration of that single syscall
in both the no-children and running-children cases; the impact of this
is one to two syscalls (depending on _launched_processes_lock state)
per loop

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Don Brady <don.brady@delphix.com>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #11924
Closes #11928
2021-04-22 17:49:21 -07:00
..
arc_summary arc_summary3: just read /s/m/{mod}/version instead of spawning cat 2021-04-11 11:57:14 -07:00
arcstat FreeBSD: Update usage of py-sysctl 2020-12-10 15:28:31 -08:00
dbufstat dbufstat: Fix warnings with Python 3.8 2020-12-23 15:10:35 -08:00
fsck_zfs fsck.zfs: implement 4/8 exit codes as suggested in manpage 2021-03-31 10:49:56 -07:00
mount_zfs cppcheck: integrete cppcheck 2021-01-26 16:12:26 -08:00
raidz_test Removed duplicated includes 2021-03-22 12:34:58 -07:00
vdev_id vdev_id: Create symlinks even if no /dev/mapper/ 2021-03-08 08:43:30 -08:00
zdb Add zdb -r <dataset> <object-id | file> <output> 2021-01-27 21:36:01 -08:00
zed zed: protect against wait4()/fork() races to the launched process tree 2021-04-22 17:49:21 -07:00
zfs libzfs: get rid of libzfs_handle::libzfs_mnttab 2021-04-13 14:14:44 -07:00
zfs_ids_to_path zfs_ids_to_path: print correct wrong values 2021-04-11 11:58:16 -07:00
zgenhostid Fix various typos 2021-04-02 18:52:15 -07:00
zhack cppcheck: integrete cppcheck 2021-01-26 16:12:26 -08:00
zinject cppcheck: integrete cppcheck 2021-01-26 16:12:26 -08:00
zpool Fix vdev health padding in zpool list -v 2021-04-14 09:02:16 -07:00
zpool_influxdb cppcheck: integrete cppcheck 2021-01-26 16:12:26 -08:00
zstream Suppress cppcheck invalidSyntax warninigs 2021-03-05 17:56:35 -08:00
zstreamdump zstreamdump: exec zstream dump 2021-04-11 11:55:58 -07:00
ztest Fix various typos 2021-04-02 18:52:15 -07:00
zvol_id cppcheck: integrete cppcheck 2021-01-26 16:12:26 -08:00
zvol_wait zvol_wait: properly handle zvol_volmode sysctl being 3/none 2021-04-11 11:58:36 -07:00
Makefile.am cppcheck: integrete cppcheck 2021-01-26 16:12:26 -08:00