If we are in the middle of an incremental 'zfs receive', the child .../%recv 
will exist. If we run 'zfs promote' .../%recv, it will "work", but then zfs 
gets confused about the status of the new dataset.
Attempting to do this promote should be an error. Similarly renaming .../%recv 
datasets should not be allowed.

```
root@openindiana:~# POOLNAME='testpool'
root@openindiana:~# TMPDIR='/tmp'
root@openindiana:~# zpool destroy -f $POOLNAME
root@openindiana:~# rm -f $TMPDIR/zpool_$POOLNAME.dat
root@openindiana:~# mkfile 128m $TMPDIR/zpool.dat
root@openindiana:~# zpool create -O mountpoint=$TMPDIR/$POOLNAME $POOLNAME 
$TMPDIR/zpool.dat
root@openindiana:~# zfs create -o mountpoint=$TMPDIR/$POOLNAME/src 
$POOLNAME/src 
root@openindiana:~# dd if=/dev/urandom of=/$TMPDIR/$POOLNAME/src/file.dat bs=1M 
count=10
10+0 records in
10+0 records out
10485760 bytes transferred in 1.332270 secs (7870596 bytes/sec)
root@openindiana:~# zfs snap $POOLNAME/src@snap1
root@openindiana:~# dd if=/dev/urandom of=/$TMPDIR/$POOLNAME/src/file.dat bs=1M 
count=10
10+0 records in
10+0 records out
10485760 bytes transferred in 1.186960 secs (8834133 bytes/sec)
root@openindiana:~# zfs snap $POOLNAME/src@snap2
root@openindiana:~# dd if=/dev/urandom of=/$TMPDIR/$POOLNAME/src/file.dat bs=1M 
count=10
10+0 records in
10+0 records out
10485760 bytes transferred in 4.167742 secs (2515933 bytes/sec)
root@openindiana:~# zfs snap $POOLNAME/src@snap3
root@openindiana:~# zfs send -p $POOLNAME/src@snap1 | zfs recv -vu $POOLNAME/dst
receiving full stream of testpool/src@snap1 into testpool/dst@snap1
received 10.1MB stream in 2 seconds (5.04MB/sec)
root@openindiana:~# zfs send -pI $POOLNAME/src@snap1 $POOLNAME/src@snap3 | dd 
bs=1M count=15 | zfs recv -svu $POOLNAME/dst
0+15 records in
0+15 records out
7492 bytes transferred in 0.047300 secs (158394 bytes/sec)
receiving incremental stream of testpool/src@snap2 into testpool/dst@snap2
cannot receive incremental stream: checksum mismatch or incomplete stream.
Partially received snapshot is saved.
A resuming stream can be generated on the sending system by running:
    zfs send -t 
1-d1172b276-e8-789c636064000310a501c49c50360710a715e5e7a69766a63040c124fbd9856f99765a2b00d9ec48eaf293b252934b207c10c0904f4b2b4e2d618003903c1b927c5265496a3103aa3cb2fe927c882b7c22ce963d29dbd4658024cf0996cf4bcc4d05d2a9c52505f9f939fac545c90ec57989054608330126352022
root@openindiana:~# zfs get name,inconsistent,mountpoint,origin 
$POOLNAME/dst/%recv
NAME                PROPERTY      VALUE                    SOURCE
testpool/dst/%recv  name          testpool/dst/%recv       -
testpool/dst/%recv  inconsistent  1                        -
testpool/dst/%recv  mountpoint    /tmp/testpool/src/%recv  inherited from 
testpool/dst
testpool/dst/%recv  origin        testpool/dst@snap1       -
root@openindiana:~# zfs promote $POOLNAME/dst/%recv
root@openindiana:~# 
root@openindiana:~# zfs destroy $POOLNAME/dst
cannot destroy 'testpool/dst': dataset already exists
root@openindiana:~# zfs destroy -r $POOLNAME/dst
cannot destroy 'testpool/dst': dataset already exists
root@openindiana:~# zfs destroy -rR $POOLNAME/dst
cannot destroy 'testpool/dst': dataset already exists
root@openindiana:~# 
```

Illumos issue: https://www.illumos.org/issues/8942
ZFS on Linux PR: zfsonlinux/zfs#6339
You can view, comment on, or merge this pull request online at:

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

-- Commit Summary --

  * 8942 zfs promote .../%recv should be an error

-- File Changes --

    M usr/src/lib/libzfs/common/libzfs_dataset.c (7)
    M usr/src/test/zfs-tests/include/libtest.shlib (35)
    M 
usr/src/test/zfs-tests/tests/functional/cli_root/zfs_promote/zfs_promote_006_neg.ksh
 (13)
    M 
usr/src/test/zfs-tests/tests/functional/cli_root/zfs_rename/zfs_rename.cfg (1)
    M 
usr/src/test/zfs-tests/tests/functional/cli_root/zfs_rename/zfs_rename.kshlib 
(5)
    M 
usr/src/test/zfs-tests/tests/functional/cli_root/zfs_rename/zfs_rename_004_neg.ksh
 (4)
    M usr/src/uts/common/fs/zfs/zfs_ioctl.c (12)

-- Patch Links --

https://github.com/openzfs/openzfs/pull/512.patch
https://github.com/openzfs/openzfs/pull/512.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/512

------------------------------------------
openzfs-developer
Archives: 
https://openzfs.topicbox.com/groups/developer/discussions/T744170d0ad8ac98e-Me5b2a931a6e3c29ca84292ce
Powered by Topicbox: https://topicbox.com

Reply via email to