[Bug 249579] [ZFS] Can't resume a zfs receive stream to a dataset with a mounted clone

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Thu Sep 24 16:14:42 UTC 2020


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=249579

            Bug ID: 249579
           Summary: [ZFS] Can't resume a zfs receive stream to a dataset
                    with a mounted clone
           Product: Base System
           Version: 12.1-STABLE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Many People
          Priority: ---
         Component: bin
          Assignee: bugs at FreeBSD.org
          Reporter: asomers at FreeBSD.org

On FreeBSD stable/12, you cannot receive a resumed ZFS stream into a dataset
that has a mounted clone.  The bug was likely introduced by r364412.  The
problem is that when receiving libzfs tries to unmount any dataset whose
mountpoint might be changed.  Such datasets include all children of the
destination, as well as all clones of those children.  Clones of the
destination itself SHOULD NOT be included, but libzfs includes them anyway. 
Datasets whose mountpoint property is locally set also SHOULD NOT be included,
but libzfs seems to include them anyway, too.  The problem is not reproducible
on head (which has switched to OpenZFS), because OpenZFS's libzfs does not try
to unmount datasets when receiving a stream.  I don't know why not.

Steps to reproduce:
> sudo zpool create tank vtbd1
> sudo zfs create tank/src
> sudo dd if=/dev/zero bs=1m count=1024 of=/tank/src/zerofile
1024+0 records in
1024+0 records out
1073741824 bytes transferred in 8.282515 secs (129639593 bytes/sec)
> sudo zfs snapshot tank/src at 1
> sudo zfs send -R tank/src at 1 | sudo zfs recv -vs tank/dst
receiving full stream of tank/src at 1 into tank/dst at 1
received 1.00GB stream in 4 seconds (257MB/sec)
> sudo zfs clone tank/dst at 1 tank/clone
> # In another shell, cd to /tank/clone
> sudo dd if=/dev/zero bs=1m count=1024 of=/tank/src/zerofile2
1024+0 records in
1024+0 records out
1073741824 bytes transferred in 5.961812 secs (180103269 bytes/sec)
> sudo zfs snapshot tank/src at 2
> sudo zfs send -i tank/src at 1 tank/src at 2 | head -c 536870912 | sudo zfs receive  -vs tank/dst
receiving incremental stream of tank/src at 2 into tank/dst at 2
warning: cannot send 'tank/src at 2': signal received
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-XXXXXX
> sudo zfs send -t 1-XXXXXX | sudo zfs receive -vs tank/dst
cannot unmount '/tank/clone': Device busy

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-bugs mailing list