-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Fix optional "force" arg handing in zfs_ioc_pool_sync() #11284
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ghost
suggested changes
Dec 8, 2020
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nvpair_type DATA_TYPE_BOOLEAN
!= DATA_TYPE_BOOLEAN_VALUE
, you have to check its value because it can be false
.
Lines 222 to 240 in dcbf847
/* | |
* Use ZFS_IOC_POOL_SYNC to confirm if a pool is active | |
*/ | |
fd = open(ZFS_DEV, O_RDWR); | |
if (fd < 0) | |
return (-1); | |
zcp = umem_zalloc(sizeof (zfs_cmd_t), UMEM_NOFAIL); | |
innvl = fnvlist_alloc(); | |
fnvlist_add_boolean_value(innvl, "force", B_FALSE); | |
(void) strlcpy(zcp->zc_name, name, sizeof (zcp->zc_name)); | |
packed = fnvlist_pack(innvl, &size); | |
zcp->zc_nvlist_src = (uint64_t)(uintptr_t)packed; | |
zcp->zc_nvlist_src_size = size; | |
ret = zfs_ioctl_fd(fd, ZFS_IOC_POOL_SYNC, zcp); |
The fnvlist_lookup_boolean_value() function should not be used to check the force argument since it's optional. It may not be provided or may have been created with the wrong flags. Signed-off-by: Brian Behlendorf <[email protected]> Issue openzfs#11281
behlendorf
force-pushed
the
issue-11281
branch
from
December 8, 2020 18:44
87e2772
to
bd994ff
Compare
It does appear we set it this way. Updated. |
ghost
approved these changes
Dec 8, 2020
behlendorf
added
Status: Accepted
Ready to integrate (reviewed, tested)
and removed
Status: Code Review Needed
Ready for review and testing
labels
Dec 9, 2020
ghost
pushed a commit
to zfsonfreebsd/ZoF
that referenced
this pull request
Dec 23, 2020
The fnvlist_lookup_boolean_value() function should not be used to check the force argument since it's optional. It may not be provided or may have been created with the wrong flags. Reviewed-by: Ryan Moeller <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes openzfs#11281 Closes openzfs#11284
behlendorf
added a commit
that referenced
this pull request
Dec 23, 2020
The fnvlist_lookup_boolean_value() function should not be used to check the force argument since it's optional. It may not be provided or may have been created with the wrong flags. Reviewed-by: Ryan Moeller <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #11281 Closes #11284
jsai20
pushed a commit
to jsai20/zfs
that referenced
this pull request
Mar 30, 2021
The fnvlist_lookup_boolean_value() function should not be used to check the force argument since it's optional. It may not be provided or may have been created with the wrong flags. Reviewed-by: Ryan Moeller <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes openzfs#11281 Closes openzfs#11284
sempervictus
pushed a commit
to sempervictus/zfs
that referenced
this pull request
May 31, 2021
The fnvlist_lookup_boolean_value() function should not be used to check the force argument since it's optional. It may not be provided or may have been created with the wrong flags. Reviewed-by: Ryan Moeller <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes openzfs#11281 Closes openzfs#11284
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation and Context
Issue #11281
Description
When checking if the "force" argument is set it is sufficient
to use nvlist_exists(). fnvlist_lookup_boolean_value() should
not be used in this case since it's never allowed to fail which
can happen when the provided nvlist does not set NV_UNIQUE_NAME.
This is consistent with the boolean option handling for the
other ioctls.
How Has This Been Tested?
Using the test case provided in #11281.
Types of changes
Checklist:
Signed-off-by
.