> @@ -594,9 +595,14 @@ lzc_receive_impl(const char *snapname, nvlist_t *props, 
> const char *origin,
>               (void) strlcpy(zc.zc_string, origin, sizeof (zc.zc_string));
>  
>       /* zc_begin_record is non-byteswapped BEGIN record */
> -     error = recv_read(fd, &zc.zc_begin_record, sizeof (zc.zc_begin_record));
> -     if (error != 0)
> -             goto out;
> +     if (begin_record == NULL) {
> +             error = recv_read(fd, &zc.zc_begin_record,
> +                 sizeof (zc.zc_begin_record));
> +             if (error != 0)
> +                     goto out;
> +     } else {
> +             zc.zc_begin_record.drr_u.drr_begin = *begin_record;

In this case we are not filling in the other fields of the dmu_replay_record_t. 
 We should set drr_type = DRR_BEGIN, although it happens that DRR_BEGIN=0 so 
this happens to work.

More problematically, drr_payloadlen needs to be filled in, because if this is 
a resuming stream, it will have a payload (see dmu_recv_stream()).  Can you 
make the caller provide the whole dmu_replay_record_t rather than just the 
struct drr_begin?

---
Reply to this email directly or view it on GitHub:
https://github.com/openzfs/openzfs/pull/30/files#r43563848
_______________________________________________
developer mailing list
developer@open-zfs.org
http://lists.open-zfs.org/mailman/listinfo/developer

Reply via email to