HomeFreeBSD

libzfs: run_process: set O_NONBLOCK on lines pipe

Description

libzfs: run_process: set O_NONBLOCK on lines pipe

Without this, we can deadlock: the child is stuck writing to the pipe,
and we are stuck waiting on the child

With this, we the child fills up the pipe (a few hundred kBish)
and starts getting EAGAINs, which allows it to either crash
or ignore them

libzfs_run_process_get_stdout*() is used only by zpool -c scripts,
which output short runs of K=V pairs, so the likelihood of losing
legitimate data there is relatively low

Reviewed-by: John Kennedy <john.kennedy@delphix.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #12082

Details

Provenance
наб <nabijaczleweli@nabijaczleweli.xyz>Authored on May 19 2021, 11:56 AM
Brian Behlendorf <behlendorf1@llnl.gov>Committed on May 21 2021, 4:47 PM
Parents
rGe72383825bbd: raidz_test: use only async-signal-safe functions in signal handler
Branches
Unknown
Tags
Unknown

Event Timeline

Brian Behlendorf <behlendorf1@llnl.gov> committed rG30dadd5c04be: libzfs: run_process: set O_NONBLOCK on lines pipe (authored by наб <nabijaczleweli@nabijaczleweli.xyz>).May 21 2021, 4:47 PM