Skip to content

Conversation

@chungy
Copy link
Contributor

@chungy chungy commented May 12, 2021

Motivation and Context

When creating a new zfs file system and -o utf8only=off is passed as a parameter, the option could silently be overridden and switched to the on state due to the parent dataset having a normalization value != none. This is counter-intuitive and potentially harmful as it may go unnoticed until a non-UTF8 conforming file name is attempted to be created, at which moment the normal error about an invalid UTF8 sequence will be returned.

The zfsprops(8) manpage for utf8only has language already that might imply this: "If this property is explicitly set to off, the normalization property must either not be explicitly set or be set to none."

I describe the issue in #11892 with an example sequence of commands that triggers the bad behavior.

Description

lib/libzfs/libzfs_dataset.c already has code that detects when the normalization property is set and switches utf8only to on. Added another conditional to set normalization to none when utf8only is set to off.

How Has This Been Tested?

Compiled a version of ZFS with this change, ran my sample commands as I presented in the open issue, and checked the utf8only and normalization properties to make sure they are set as appropriate.

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:

@behlendorf behlendorf added the Status: Code Review Needed Ready for review and testing label May 12, 2021
@chungy
Copy link
Contributor Author

chungy commented Oct 6, 2021

Has there been any progress on looking after this PR?

@behlendorf
Copy link
Contributor

Thanks for reminding us about this and the clear explanation of the problem. I agree, this behavior is pretty unexpected and we should be honoring the explicit override. If you can 1) force rebase this PR against latest master branch, and 2) add your test case to the test suite, then we should be able to get this merged.

You'll want to add it to the tests/zfs-tests/tests/functional/casenorm/ directory, and make sure to include the new test script to the Makefile.am. You should be able to model the test after some of the existing test scripts, but let me know if you need a hand.

@chungy
Copy link
Contributor Author

chungy commented Oct 6, 2021

I've written a test case where I thought appropriate and ran it with both my code change and without, seems to work without issue.

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.

Thank you, this looks good to me.

When a parent dataset has normalization set to any value other than
"none", and a file system is created with the property "utf8only=off",
implicitly also set "normalization=none" instead of overriding the
desire for a non-UTF8 enforcing file system.

Signed-off-by: Mike Swanson <mikeonthecomputer@gmail.com>
Closes openzfs#11892
Based on the prior commit, utf8only=off should maintain its status
even when a parent dataset has normalization!=none.
@behlendorf behlendorf added Status: Accepted Ready to integrate (reviewed, tested) and removed Status: Code Review Needed Ready for review and testing labels Oct 29, 2021
@behlendorf behlendorf merged commit 321c1b6 into openzfs:master Oct 29, 2021
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