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

Allow pool names that are not reserved but only start with reserved #7208

Closed
wants to merge 1 commit into from

Conversation

kusumi
Copy link
Member

@kusumi kusumi commented Feb 21, 2018

zpool(8) says "The pool names mirror, raidz, spare and log are
reserved,", but the command actually avoids entire patterns which
start with "mirror"/"raidz"/"spare" by using strncmp(3) without
terminating null considered. It does right for "log" by not using
strncmp(3) with size of 3 (should be 4 or strcmp(3)).
(or fix zpool(8) man page if this is really intended behavior.)

e.g. zpool(8) avoids "spare<something>".
# zpool create spareribs /dev/sdb
cannot create 'spareribs': name is reserved
pool name may have been omitted

Description

Fixes zpool_name_valid() used for sanity checks of zpool name.
strncmp(3) size should contain termination null string.

Motivation and Context

Allow pool names that are not reserved but only start with reserved names.

How Has This Been Tested?

By running for e.g. zpool create command.

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)
  • Documentation (a change to man pages or other documentation)

Checklist:

  • My code follows the ZFS on Linux code style requirements.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • All commit messages are properly formatted and contain Signed-off-by.
  • Change has been approved by a ZFS on Linux member.

zpool(8) says "The pool names mirror, raidz, spare and log are
reserved,", but the command actually avoids entire patterns which
start with "mirror"/"raidz"/"spare" by using strncmp(3) without
terminating null considered. It does right for "log" by not using
strncmp(3) with size of 3 (should be 4 or strcmp(3)).

(or fix zpool(8) man page if this is really intended behavior.)

--
e.g. zpool(8) avoids "spare<something>".
 # zpool create spareribs /dev/sdb
 cannot create 'spareribs': name is reserved
 pool name may have been omitted

Signed-off-by: Tomohiro Kusumi <kusumi.tomohiro@osnexus.com>
@codecov
Copy link

codecov bot commented Feb 22, 2018

Codecov Report

Merging #7208 into master will decrease coverage by 0.23%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #7208      +/-   ##
==========================================
- Coverage   76.43%    76.2%   -0.24%     
==========================================
  Files         327      327              
  Lines      103785   103785              
==========================================
- Hits        79333    79093     -240     
- Misses      24452    24692     +240
Flag Coverage Δ
#kernel 76.21% <ø> (-0.08%) ⬇️
#user 65.3% <100%> (-0.59%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f2c0dee...64c32e2. Read the comment docs.

@behlendorf
Copy link
Contributor

@kusumi rather than allow these pool names let's update the documentation accordingly. While we could fix this with your patch, my concern is that if we were to do so then it would be possible to unwitingly create pools on Linux which wouldn't work properly on the other OpenZFS platforms.

kusumi added a commit to kusumi/zfs that referenced this pull request Feb 22, 2018
PR openzfs#7208 was originally a patch to allow pool names which begin with
mirror,raidz,spare (but do not equal), however we rather document it
in the man page for compatibility with other OpenZFS implementations,
i.e. avoid pool names that may not work on non-Linux platforms.

Signed-off-by: Tomohiro Kusumi <kusumi.tomohiro@osnexus.com>
Closes openzfs#7208
kusumi added a commit to kusumi/zfs that referenced this pull request Feb 22, 2018
PR openzfs#7208 was a patch to allow non-reserved pool names which begin with
mirror,raidz,spare (but do not equal), however we rather document it
in the man page for compatibility with other OpenZFS implementations,
i.e. avoid pool names that may not work on non-Linux platforms.

Signed-off-by: Tomohiro Kusumi <kusumi.tomohiro@osnexus.com>
Closes openzfs#7208
@kusumi
Copy link
Member Author

kusumi commented Feb 22, 2018

Sure. I have created #7216.

@kusumi kusumi closed this Feb 22, 2018
behlendorf pushed a commit that referenced this pull request Mar 9, 2018
PR #7208 was a patch to allow non-reserved pool names which begin with
mirror, raidz, spare (but do not equal), however we'd rather document
it in the man page for compatibility with other OpenZFS implementations,
to avoid pool names that may not work on non-Linux platforms.

Reviewed-by: Richard Laager <rlaager@wiktel.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Tomohiro Kusumi <kusumi.tomohiro@osnexus.com>
Closes #7216
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants