kern/157728: zfs (v28) incremental receive may leave behind temporary clones

Martin Matuska mm at
Thu Jun 9 14:20:09 UTC 2011

>Number:         157728
>Category:       kern
>Synopsis:       zfs (v28) incremental receive may leave behind temporary clones
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Jun 09 14:20:08 UTC 2011
>Originator:     Martin Matuska
>Release:        FreeBSD 8.2-STABLE amd64
System: FreeBSD 8.2-STABLE #2 r222851M: Wed Jun  8 07:24:58 CEST 2011
	zfs receive (v28) may leave behind temporary clones if doing
	a parallel zfs list on an incremental snapshot being received.

	The temporary clone gets properly removed in Nexenta and OpenIndiana
	(but not immediately after zfs receive finishes - there is
	a small delay).

	In FreeBSD, something prevents the process/thread responsible for
	removing the clone doing its job.
zpool destroy test
if [ ! -f "/tmp/testfile" ]; then
	dd if=/dev/zero of=/tmp/testfile bs=1M count=250
zpool create test /tmp/testfile
zfs create test/d1
#dd if=/dev/zero of=/test/d1/file1 bs=1M count=100
zfs snapshot test/d1 at s1
#rm /test/d1/file1
zfs send test/d1 at s1 | zfs recv test/d2
zfs snapshot test/d1 at s2
( sleep 1; zfs send -I @s1 test/d1 at s2 | zfs recv test/d2) &
while test "$OK" != "1"; do
zfs list -H test/d2 at s2 >/dev/null 2>/dev/null && OK=1
zfs destroy test/d2 at s1
zdb -d test | grep %

cannot destroy 'test/d2 at s1': dataset already exists
Could not open test/d2/%s2, error 16
For now only a workaround:
- do not do zfs list
- destroy temporary clone afterwards (zfs destroy test/d2/%s2)

More information about the freebsd-bugs mailing list