The fix is correct.

It has been fixed in OpenSolaris rev. 9396.
I have filed a PR kern/145377

The PR includes the complete patch from OpenSolaris including their
commented code.

Link:
http://www.freebsd.org/cgi/query-pr.cgi?pr=145377

Dňa 3. 4. 2010 17:29, Andriy Gapon  wrote / napísal(a):
> on 03/04/2010 18:19 Andriy Gapon said the following:
>   
>> It seems that this commit causes a crash in zfs(1) when e.g. 'zfs list' is
>> executed and one of the filesystems has a user property set on it.
>>
>> The crash is in zfs_prune_proplist function at
>> cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c:4291.
>>
>> Relevant code snippet:
>> 4286
>> 4287            while (curr) {
>> 4288                    zfs_prop_t zfs_prop = 
>> zfs_name_to_prop(nvpair_name(curr));
>> 4289                    nvpair_t *next = nvlist_next_nvpair(zhp->zfs_props, 
>> curr);
>> 4290
>> 4291                    if (props[zfs_prop] == B_FALSE)
>> 4292                            (void) nvlist_remove(zhp->zfs_props,
>> 4293                                nvpair_name(curr), nvpair_type(curr));
>> 4294                    curr = next;
>> 4295            }
>>
>> zfs_prop is (-1) and nvpair_name(curr) is my custom property "avg:nobackup".
>> Not sure if this was fixed in OpenSolaris or what.
>>     
> BTW, I use this simplistic change for time being, not sure if this is a 
> correct fix.
>
> --- a/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c
> +++ b/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c
> @@ -4288,7 +4288,7 @@ zfs_prune_proplist(zfs_handle_t *zhp, uint8_t *props)
>               zfs_prop_t zfs_prop = zfs_name_to_prop(nvpair_name(curr));
>               nvpair_t *next = nvlist_next_nvpair(zhp->zfs_props, curr);
>
> -             if (props[zfs_prop] == B_FALSE)
> +             if (zfs_prop != ZPROP_INVAL && props[zfs_prop] == B_FALSE)
>                       (void) nvlist_remove(zhp->zfs_props,
>                           nvpair_name(curr), nvpair_type(curr));
>               curr = next;
>
>
>   
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to