Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add workaround for broken Linux pipes #13309

Merged
merged 2 commits into from
May 9, 2022
Merged

Conversation

rincebrain
Copy link
Contributor

Motivation and Context

I couldn't stop hitting #13232 on my Pi 4 when I wanted to benchmark some things.

Description

Adds an env variable, ZFS_NO_PIPE_MAX, which disables the problematic F_SETPIPE_SZ.

This should be documented somewhere, but I wasn't sure where - zfs(8)? zfs-recv(8)? zpool(8)?

How Has This Been Tested?

WIthout this change, running dd [send stream] | zfs recv on my Pi 4 hangs at least once every 5 times, often more frequently; with this change and no env variable set, same thing; with it set, it hasn't hung in 1024 runs.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Performance enhancement (non-breaking change which improves efficiency)
  • Code cleanup (non-breaking change which makes code smaller or more readable)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Library ABI change (libzfs, libzfs_core, libnvpair, libuutil and libzfsbootenv)
  • Documentation (a change to man pages or other documentation)

Checklist:

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.

Signed-off-by: Rich Ercolani <[email protected]>
Copy link
Contributor

@behlendorf behlendorf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's quite unfortunate. Given how easily you've been able to hit this I wonder if we shouldn't instead invert the logic here and disable this optimization by default. Do you have a feel for how much increasing the pipe size really helps performance?

@behlendorf behlendorf added the Status: Code Review Needed Ready for review and testing label Apr 11, 2022
@rincebrain
Copy link
Contributor Author

It seemed to need a slow system to be reasonably often hittable.

I can benchmark it with and without later.

@behlendorf
Copy link
Contributor

About the documentation, adding it to zfs.8 seem reasonable. We already document the ZFS_MOUNT_HELPER environment variable here.

@szubersk
Copy link
Contributor

Nice catch, Rich!

I don't see https://bugzilla.kernel.org/show_bug.cgi?id=212295 integrated into the current Linux master branch. This issue is destined to come back over and over again on slower/embedded systems. @behlendorf suggestion to invert the logic (ZFS_PIPE_MAX) is solid, especially that the bug exists in Linux longterm 5.10 and 5.15 lines.

@rincebrain
Copy link
Contributor Author

It's not integrated anywhere, no - they emailed it to LKML once and it got no response.

@rincebrain
Copy link
Contributor Author

There, I've revised it to default to not setting the pipe size unless you specify the variable and documented it in zfs(8).

This update inspired by managing to start repeatedly hitting this on my 5900X.

Copy link
Contributor

@behlendorf behlendorf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me after sorting out the mandoc warnings.

Signed-off-by: Rich Ercolani <[email protected]>
@rincebrain
Copy link
Contributor Author

If this push fails, I'm ignoring this PR until the broken useless linter is fixed to run outside of the CI.

@behlendorf behlendorf added Status: Accepted Ready to integrate (reviewed, tested) and removed Status: Code Review Needed Ready for review and testing labels May 9, 2022
@behlendorf behlendorf merged commit a30927f into openzfs:master May 9, 2022
nicman23 pushed a commit to nicman23/zfs that referenced this pull request Aug 22, 2022
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 <[email protected]>
Signed-off-by: Rich Ercolani <[email protected]>
Closes openzfs#13309
nicman23 pushed a commit to nicman23/zfs that referenced this pull request Aug 22, 2022
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 <[email protected]>
Signed-off-by: Rich Ercolani <[email protected]>
Closes openzfs#13309
lundman pushed a commit to openzfsonwindows/openzfs that referenced this pull request Sep 6, 2022
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 <[email protected]>
Signed-off-by: Rich Ercolani <[email protected]>
Closes openzfs#13309
beren12 pushed a commit to beren12/zfs that referenced this pull request Sep 19, 2022
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 <[email protected]>
Signed-off-by: Rich Ercolani <[email protected]>
Closes openzfs#13309
andrewc12 pushed a commit to andrewc12/openzfs that referenced this pull request Sep 23, 2022
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 <[email protected]>
Signed-off-by: Rich Ercolani <[email protected]>
Closes openzfs#13309
andrewc12 pushed a commit to andrewc12/openzfs that referenced this pull request Sep 23, 2022
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 <[email protected]>
Signed-off-by: Rich Ercolani <[email protected]>
Closes openzfs#13309
andrewc12 pushed a commit to andrewc12/openzfs that referenced this pull request Sep 23, 2022
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 <[email protected]>
Signed-off-by: Rich Ercolani <[email protected]>
Closes openzfs#13309
andrewc12 pushed a commit to andrewc12/openzfs that referenced this pull request Sep 23, 2022
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 <[email protected]>
Signed-off-by: Rich Ercolani <[email protected]>
Closes openzfs#13309
andrewc12 pushed a commit to andrewc12/openzfs that referenced this pull request Sep 23, 2022
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 <[email protected]>
Signed-off-by: Rich Ercolani <[email protected]>
Closes openzfs#13309
andrewc12 pushed a commit to andrewc12/openzfs that referenced this pull request Sep 23, 2022
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 <[email protected]>
Signed-off-by: Rich Ercolani <[email protected]>
Closes openzfs#13309
andrewc12 pushed a commit to andrewc12/openzfs that referenced this pull request Sep 23, 2022
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 <[email protected]>
Signed-off-by: Rich Ercolani <[email protected]>
Closes openzfs#13309
andrewc12 pushed a commit to andrewc12/openzfs that referenced this pull request Sep 23, 2022
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 <[email protected]>
Signed-off-by: Rich Ercolani <[email protected]>
Closes openzfs#13309
andrewc12 pushed a commit to andrewc12/openzfs that referenced this pull request Sep 23, 2022
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 <[email protected]>
Signed-off-by: Rich Ercolani <[email protected]>
Closes openzfs#13309
andrewc12 pushed a commit to andrewc12/openzfs that referenced this pull request Sep 23, 2022
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 <[email protected]>
Signed-off-by: Rich Ercolani <[email protected]>
Closes openzfs#13309
andrewc12 pushed a commit to andrewc12/openzfs that referenced this pull request Sep 23, 2022
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 <[email protected]>
Signed-off-by: Rich Ercolani <[email protected]>
Closes openzfs#13309
andrewc12 pushed a commit to andrewc12/openzfs that referenced this pull request Sep 23, 2022
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 <[email protected]>
Signed-off-by: Rich Ercolani <[email protected]>
Closes openzfs#13309
andrewc12 pushed a commit to andrewc12/openzfs that referenced this pull request Sep 23, 2022
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 <[email protected]>
Signed-off-by: Rich Ercolani <[email protected]>
Closes openzfs#13309
andrewc12 pushed a commit to andrewc12/openzfs that referenced this pull request Sep 23, 2022
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 <[email protected]>
Signed-off-by: Rich Ercolani <[email protected]>
Closes openzfs#13309
andrewc12 pushed a commit to andrewc12/openzfs that referenced this pull request Sep 23, 2022
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 <[email protected]>
Signed-off-by: Rich Ercolani <[email protected]>
Closes openzfs#13309
andrewc12 pushed a commit to andrewc12/openzfs that referenced this pull request Sep 23, 2022
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 <[email protected]>
Signed-off-by: Rich Ercolani <[email protected]>
Closes openzfs#13309
andrewc12 pushed a commit to andrewc12/openzfs that referenced this pull request Sep 23, 2022
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 <[email protected]>
Signed-off-by: Rich Ercolani <[email protected]>
Closes openzfs#13309
andrewc12 pushed a commit to andrewc12/openzfs that referenced this pull request Sep 23, 2022
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 <[email protected]>
Signed-off-by: Rich Ercolani <[email protected]>
Closes openzfs#13309
andrewc12 pushed a commit to andrewc12/openzfs that referenced this pull request Sep 23, 2022
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 <[email protected]>
Signed-off-by: Rich Ercolani <[email protected]>
Closes openzfs#13309
ElvishJerricco pushed a commit to ElvishJerricco/zfs that referenced this pull request Jan 3, 2023
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 <[email protected]>
Signed-off-by: Rich Ercolani <[email protected]>
Closes openzfs#13309
rincebrain added a commit to rincebrain/zfs that referenced this pull request Jan 3, 2023
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 <[email protected]>
Signed-off-by: Rich Ercolani <[email protected]>
Closes openzfs#13309
rincebrain added a commit to rincebrain/zfs that referenced this pull request Jan 3, 2023
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 <[email protected]>
Signed-off-by: Rich Ercolani <[email protected]>
Closes openzfs#13309
behlendorf pushed a commit that referenced this pull request Jan 5, 2023
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 <[email protected]>
Signed-off-by: Rich Ercolani <[email protected]>
Closes #13309
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Accepted Ready to integrate (reviewed, tested)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants