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" instead of the actual 
property name.

These are properties set on a filesystem when failing to receive a truncated 
stream:
```
[root@52-54-00-d3-7a-01 ~]# zdb -dddd testpool 49
Dataset mos [META], ID 0, cr_txg 4, 114K, 64 objects, rootbp 
DVA[0]=<0:17b2e00:200> DVA[1]=<0:17b3000:200> DVA[2]=<0:17b3200:200> [L0 DMU 
objset] fletcher4 lz4 LE contiguous unique triple size=800L/200P 
birth=498L/498P fill=64 
cksum=11413d065e:672e12e9d76:13ff1f57e066a:2ac3890cc2454c

    Object  lvl   iblk   dblk  dsize  lsize   %full  type
        49    1   128K    512      0    512  100.00  DSL props
    dnode flags: USED_BYTES 
    dnode maxblkid: 0
    microzap: 512 bytes, 2 entries

        value$recvd = 1 
        $hasrecvd = 0
```

References: https://github.com/zfsonlinux/zfs/pull/5497

Reproducer: 

```
# misc functions
function is_linux() {
   if [[ "$(uname)" == "Linux" ]]; then
      return 0
   else
      return 1
   fi
}
# setup
POOLNAME='testpool'
if is_linux; then
   TMPDIR='/var/tmp'
   mountpoint -q $TMPDIR || mount -t tmpfs tmpfs $TMPDIR
   zpool destroy $POOLNAME
   fallocate -l 65m $TMPDIR/zpool.dat
   zpool create $POOLNAME $TMPDIR/zpool.dat
else
   TMPDIR='/tmp'
   zpool destroy $POOLNAME
   mkfile 65m $TMPDIR/zpool.dat
   zpool create $POOLNAME $TMPDIR/zpool.dat
fi
# send first stream, received compression is 'on'
zfs create $POOLNAME/send
zfs set compression=on $POOLNAME/send
zfs snap $POOLNAME/send@snap1
zfs send -p $POOLNAME/send@snap1 > $TMPDIR/snap_full.dat
zfs recv $POOLNAME/recv < $TMPDIR/snap_full.dat
zfs get -o all compression $POOLNAME/recv
# send second stream, compression is 'lz4'
zfs set compression=lz4 $POOLNAME/send
dd if=/dev/urandom of=/$POOLNAME/send/urandom bs=1M count=10
zfs snap $POOLNAME/send@snap2
zfs send -pI $POOLNAME/send@snap1 $POOLNAME/send@snap2 > $TMPDIR/snap_incr.dat
# truncate the stream, fail to receive incremental
dd if=/dev/null of=$TMPDIR/snap_incr.dat bs=1 count=1 seek=9M
zfs recv -F $POOLNAME/recv < $TMPDIR/snap_incr.dat
# zfs receive failed, compression should be 'on'
zfs get -o all compression $POOLNAME/recv
```
You can view, comment on, or merge this pull request online at:

  https://github.com/openzfs/openzfs/pull/405

-- Commit Summary --

  * 8408 dsl_props_set_sync_impl() does not handle nested nvlists correctly

-- File Changes --

    M usr/src/pkg/manifests/system-test-zfstest.mf (3)
    M usr/src/test/zfs-tests/runfiles/delphix.run (2)
    M usr/src/test/zfs-tests/runfiles/omnios.run (3)
    M usr/src/test/zfs-tests/runfiles/openindiana.run (3)
    A 
usr/src/test/zfs-tests/tests/functional/cli_root/zfs_receive/zfs_receive_014_pos.ksh
 (122)
    M usr/src/uts/common/fs/zfs/dsl_prop.c (14)

-- Patch Links --

https://github.com/openzfs/openzfs/pull/405.patch
https://github.com/openzfs/openzfs/pull/405.diff

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/openzfs/openzfs/pull/405

------------------------------------------
openzfs-developer
Archives: 
https://openzfs.topicbox.com/groups/developer/discussions/Tb439a95d6a3fef31-M25ca70bc6156e4234a3ae449
Powered by Topicbox: https://topicbox.com

Reply via email to