-
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 dsl_props_set_sync_impl to work with nested nvlist #5497
Fix dsl_props_set_sync_impl to work with nested nvlist #5497
Conversation
@loli10K, thanks for your PR! By analyzing the history of the files in this pull request, we identified @ahrens, @behlendorf and @scsiguy to be potential reviewers. |
1e3854a
to
3746b84
Compare
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.
Nice find and test case. It took me a while to wrap my head around exactly why this is needed. Only after examining dsl_prop_get_all_impl()
as referenced in dsl_props_set_sync_impl
was it clear.
My only suggestion would be to clarify that comment to make it clear why exactly this is needed. A brief description of the expected format of the props
variable would have been extremely helpful.
Something like this https://github.com/zfsonlinux/zfs/blob/zfs-0.6.5.8/module/nvpair/nvpair.c#L56 would suffice? |
@loli10K sorry I wasn't clear. What was confusing to me initially was why the |
* returned by the counterpart dsl_prop_get_all_impl(). | ||
* For instance we do this to restore the original | ||
* received properties when an error occurs in the | ||
* zfs_ioc_recv() codepath. | ||
*/ |
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.
@behlendorf
I don't know if this is what you had in mind ... i'm not good at explaining things.
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.
Yes, that'll work. Thanks.
When iterating over the input nvlist in dsl_props_set_sync_impl() when we don't preserve the nvpair name before looking up ZPROP_VALUE, so when we later go to process it nvpair_name() is always "value" and not the actual property name. This fixes a couple of bugs in zfs_ioc_recv(): * Received properties were not restored correctly when failing to receive an incremental send stream * Received properties were not completely replaced by the new ones when successfully receiving an incremental send stream Signed-off-by: loli10K <[email protected]>
3607c96
to
834d4e9
Compare
When iterating over the input nvlist in dsl_props_set_sync_impl() when we don't preserve the nvpair name before looking up ZPROP_VALUE, so when we later go to process it nvpair_name() is always "value" and not the actual property name. This fixes a couple of bugs in zfs_ioc_recv(): * Received properties were not restored correctly when failing to receive an incremental send stream * Received properties were not completely replaced by the new ones when successfully receiving an incremental send stream Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: loli10K <[email protected]> Closes openzfs#5497
When iterating over the input nvlist in dsl_props_set_sync_impl() when we don't preserve the nvpair name before looking up ZPROP_VALUE, so when we later go to process it nvpair_name() is always "value" and not the actual property name. This fixes a couple of bugs in zfs_ioc_recv(): * Received properties were not restored correctly when failing to receive an incremental send stream * Received properties were not completely replaced by the new ones when successfully receiving an incremental send stream Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: loli10K <[email protected]> Closes openzfs#5497
Description
When we iterate over the input (nested) nvlist
props
indsl_props_set_sync_impl()
we don't preserve the nvpair name before looking upZPROP_VALUE
, so when we later go to process itnvpair_name()
is always "value" and not the actual property name.Motivation and Context
This issue was discovered while trying to implement zfs receive override (-o|-x) properties, it manifests when we fail to receive a send stream causing previously received properties to be wiped clean (instead of being restored). Other codepaths may be affected.
Also, i previously assumed Illumos was not affected because i had no way to manually inject an error in
zfs_ioc_recv()
viazfs_ioc_recv_inject_err
(i used systemtap for ZoL) but now i found a way to reproduce the same behaviour on a semi-new release of smartos (20160527T033529Z) ... so it seems Illumos is affected too.I was going to push this change with the feature PR but given that it's taking more time than expected and this is a small change might as well push it for review as a separate PR.
EDIT: test case added.
How Has This Been Tested?
Shell script here: https://gist.github.com/loli10K/3828245287eb6405bfc661c17a458166 (requires systemtap and a DEBUG-compiled ZFS)
Types of changes
Checklist: