Add workaround for broken Linux pipes
Linux has an unresolved hang if you resize a pipe with bytes in it. Since there's no obvious way to detect this happening, added a workaround to disable resizing the pipe buffer if you set an environment variable. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Rich Ercolani <rincebrain@gmail.com> Closes #13309
This commit is contained in:
parent
a18d13c200
commit
a30927f763
|
@ -607,6 +607,19 @@ max_pipe_buffer(int infd)
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int cur = fcntl(infd, F_GETPIPE_SZ);
|
unsigned int cur = fcntl(infd, F_GETPIPE_SZ);
|
||||||
|
/*
|
||||||
|
* Sadly, Linux has an unfixed deadlock if you do SETPIPE_SZ on a pipe
|
||||||
|
* with data in it.
|
||||||
|
* cf. #13232, https://bugzilla.kernel.org/show_bug.cgi?id=212295
|
||||||
|
*
|
||||||
|
* And since the problem is in waking up the writer, there's nothing
|
||||||
|
* we can do about it from here.
|
||||||
|
*
|
||||||
|
* So if people want to, they can set this, but they
|
||||||
|
* may regret it...
|
||||||
|
*/
|
||||||
|
if (getenv("ZFS_SET_PIPE_MAX") == NULL)
|
||||||
|
return (cur);
|
||||||
if (cur < max && fcntl(infd, F_SETPIPE_SZ, max) != -1)
|
if (cur < max && fcntl(infd, F_SETPIPE_SZ, max) != -1)
|
||||||
cur = max;
|
cur = max;
|
||||||
return (cur);
|
return (cur);
|
||||||
|
|
|
@ -745,6 +745,14 @@ to use
|
||||||
to mount ZFS datasets.
|
to mount ZFS datasets.
|
||||||
This option is provided for backwards compatibility with older ZFS versions.
|
This option is provided for backwards compatibility with older ZFS versions.
|
||||||
.El
|
.El
|
||||||
|
.Bl -tag -width "ZFS_SET_PIPE_MAX"
|
||||||
|
.It Sy ZFS_SET_PIPE_MAX
|
||||||
|
Tells
|
||||||
|
.Nm zfs
|
||||||
|
to set the maximum pipe size for sends/recieves.
|
||||||
|
Disabled by default on Linux
|
||||||
|
due to an unfixed deadlock in Linux's pipe size handling code.
|
||||||
|
.El
|
||||||
.
|
.
|
||||||
.Sh INTERFACE STABILITY
|
.Sh INTERFACE STABILITY
|
||||||
.Sy Committed .
|
.Sy Committed .
|
||||||
|
|
Loading…
Reference in New Issue