Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 28 Jul 2017 04:25:21 +0000
From:      bugzilla-noreply@freebsd.org
To:        freebsd-bugs@FreeBSD.org
Subject:   [Bug 221060] zfs: sending/receiving a zvol within same host to the same dataset produces errors and shadow child(!) datasets
Message-ID:  <bug-221060-8@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D221060

            Bug ID: 221060
           Summary: zfs: sending/receiving a zvol within same host to the
                    same dataset produces errors and shadow child(!)
                    datasets
           Product: Base System
           Version: 11.0-STABLE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: kern
          Assignee: freebsd-bugs@FreeBSD.org
          Reporter: emz@norma.perm.ru

Sending/receiving a zvol within same host produces errors and shadow child =
(to
a zvol !) datasets.=20

For instance, it's absolutely normal to send zvol betweend hosts,

(just an example, not real output)
zfs send -Rv foo/bar@snapshot | ssh -l user remote sudo zfs receive -du tank

It's even possible to send a zvol to another pool and/or dataset:

(from now on real output from FreeBSD 11.1-BETA2)

[root@san1:~]# zfs send -Rv zfsroot/userdata/worker121@candidate | zfs rece=
ive
-e esx/userdata
full send of zfsroot/userdata/worker121@candidate estimated size is 1,03G
total estimated size is 1,03G
TIME        SENT   SNAPSHOT
06:57:59    523M   zfsroot/userdata/worker121@candidate

But it's not possible to overwrite an existing zvol on any pool using -d
argument:

[root@san1:~]# zfs create -V 8G esx/userdata/workerX
[root@san1:~]# zfs send -Rv zfsroot/userdata/worker121@candidate | zfs rece=
ive
-d esx/userdata/workerX=20=20=20
full send of zfsroot/userdata/worker121@candidate estimated size is 1,03G
total estimated size is 1,03G
TIME        SENT   SNAPSHOT
cannot open 'esx/userdata/workerX': operation not applicable to datasets of
this type
cannot receive new filesystem stream: unable to restore to destination
warning: cannot send 'zfsroot/userdata/worker121@candidate': signal received


Okay. May be it's not technically possible and should not be done either.=20
But wait.... it's possible when using -e receive argument:


[root@san1:~]# zfs send -Rv zfsroot/userdata/worker121@candidate | zfs rece=
ive
-e esx/userdata/workerX
full send of zfsroot/userdata/worker121@candidate estimated size is 1,03G
total estimated size is 1,03G
TIME        SENT   SNAPSHOT
07:04:14    559M   zfsroot/userdata/worker121@candidate

Okay. Now lets try to remove this new overwritten zvol:

[root@san1:~]# zfs destroy esx/userdata/workerX
cannot destroy 'esx/userdata/workerX': dataset already exists

Now about the bugs:

1) the error is cryptic and unclear. I found out what it means, I'll show it
below.
2) The receive -e operation in the case produces errors in dmesg:

g_dev_taste: make_dev_p() failed (gp->name=3Dzvol/esx/userdata/workerX/work=
er121,
error=3D17)
g_dev_taste: make_dev_p() failed
(gp->name=3Dzvol/esx/userdata/workerX/worker121@candidate, error=3D17)
g_dev_taste: make_dev_p() failed
(gp->name=3Dzvol/esx/userdata/workerX/worker121s1, error=3D17)
g_dev_taste: make_dev_p() failed
(gp->name=3Dzvol/esx/userdata/workerX/worker121@candidates1, error=3D17)

3) this operation creates a shadow dataset, not visible to zfs list -t all =
(a
child to the zvol - this is weird by itself, isn't it):

[root@san1:~]# zfs list -t all | more
NAME                                   USED  AVAIL  REFER  MOUNTPOINT
esx                                   4,10T  12,5T   500M  /esx
esx/shared                            3,72T  12,5T  3,72T  -

[ ... loads of esx/shared and esx/userdata children, but trust me, it's not
there - I removed it so it doen't encumber this PR ... ]

esx/userdata/workerX                  8,84G  12,5T  19,2K  -

But it's visible in zdb -d <pool>:

[root@san1:~]# zdb -d esx | grep workerX
Dataset esx/userdata/workerX/worker121@candidate [ZVOL], ID 472, cr_txg
76762261, 599M, 2 objects
Dataset esx/userdata/workerX/worker121 [ZVOL], ID 462, cr_txg 76762256, 599=
M, 2
objects
Dataset esx/userdata/workerX [ZVOL], ID 438, cr_txg 76762220, 19.2K, 2 obje=
cts

Okay, this is really what the 'zfs destroy' is trying to tell. Funny thing,
this shadow dataset should be clearable with destroy -r flag, but it isn't:

[root@san1:~]# zfs destroy -r esx/userdata/workerX=20=20=20=20=20=20=20=20=
=20=20
cannot destroy 'esx/userdata/workerX': dataset already exists

Only explicit destroy kills it (may be because the child to a zvol is an
artifact by design):

[root@san1:~]# zfs destroy -r esx/userdata/workerX/worker121
[root@san1:~]#

Things may become even more complicated, and zdb may give you the Input/out=
put
error on the pool, or even crash (this state can be cleared with
zpool/export/import):


Here's the bt after several 'zdb -d esx' messages 'Input/output error' and =
the
crash:


[root@san1:~]# gdb zdb zdb.core
GNU gdb 6.1.1 [FreeBSD]
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain condition=
s.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "amd64-marcel-freebsd"...
Core was generated by `zdb -d esx/userdata/workerX'.
Program terminated with signal 6, Aborted.
Reading symbols from /lib/libnvpair.so.2...Reading symbols from
/usr/lib/debug//lib/libnvpair.so.2.debug...done.
done.
Loaded symbols for /lib/libnvpair.so.2
Reading symbols from /lib/libumem.so.2...Reading symbols from
/usr/lib/debug//lib/libumem.so.2.debug...done.
done.
Loaded symbols for /lib/libumem.so.2
Reading symbols from /lib/libuutil.so.2...Reading symbols from
/usr/lib/debug//lib/libuutil.so.2.debug...done.
done.
Loaded symbols for /lib/libuutil.so.2
Reading symbols from /lib/libzfs.so.2...Reading symbols from
/usr/lib/debug//lib/libzfs.so.2.debug...done.
done.
Loaded symbols for /lib/libzfs.so.2
Reading symbols from /lib/libzpool.so.2...Reading symbols from
/usr/lib/debug//lib/libzpool.so.2.debug...done.
done.
Loaded symbols for /lib/libzpool.so.2
Reading symbols from /lib/libc.so.7...Reading symbols from
/usr/lib/debug//lib/libc.so.7.debug...done.
done.
Loaded symbols for /lib/libc.so.7
Reading symbols from /lib/libmd.so.6...Reading symbols from
/usr/lib/debug//lib/libmd.so.6.debug...done.
done.
Loaded symbols for /lib/libmd.so.6
Reading symbols from /lib/libutil.so.9...Reading symbols from
/usr/lib/debug//lib/libutil.so.9.debug...done.
done.
Loaded symbols for /lib/libutil.so.9
Reading symbols from /lib/libm.so.5...Reading symbols from
/usr/lib/debug//lib/libm.so.5.debug...done.
done.
Loaded symbols for /lib/libm.so.5
Reading symbols from /lib/libavl.so.2...Reading symbols from
/usr/lib/debug//lib/libavl.so.2.debug...done.
done.
Loaded symbols for /lib/libavl.so.2
Reading symbols from /lib/libbsdxml.so.4...Reading symbols from
/usr/lib/debug//lib/libbsdxml.so.4.debug...done.
done.
Loaded symbols for /lib/libbsdxml.so.4
Reading symbols from /lib/libgeom.so.5...Reading symbols from
/usr/lib/debug//lib/libgeom.so.5.debug...done.
done.
Loaded symbols for /lib/libgeom.so.5
Reading symbols from /lib/libz.so.6...Reading symbols from
/usr/lib/debug//lib/libz.so.6.debug...done.
done.
Loaded symbols for /lib/libz.so.6
Reading symbols from /lib/libzfs_core.so.2...Reading symbols from
/usr/lib/debug//lib/libzfs_core.so.2.debug...done.
done.
Loaded symbols for /lib/libzfs_core.so.2
Reading symbols from /lib/libthr.so.3...Reading symbols from
/usr/lib/debug//lib/libthr.so.3.debug...done.
done.
Loaded symbols for /lib/libthr.so.3
Reading symbols from /lib/libsbuf.so.6...Reading symbols from
/usr/lib/debug//lib/libsbuf.so.6.debug...done.
done.
Loaded symbols for /lib/libsbuf.so.6
Reading symbols from /libexec/ld-elf.so.1...Reading symbols from
/usr/lib/debug//libexec/ld-elf.so.1.debug...done.
done.
Loaded symbols for /libexec/ld-elf.so.1
#0  0x000000080158184a in thr_kill () from /lib/libc.so.7
(gdb) bt
#0  0x000000080158184a in thr_kill () from /lib/libc.so.7
#1  0x0000000801581814 in __raise (s=3D6) at /usr/src/lib/libc/gen/raise.c:=
52
#2  0x0000000801581789 in abort () at /usr/src/lib/libc/stdlib/abort.c:65
#3  0x00000008011a1471 in ddt_load (spa=3D<value optimized out>) at assfail=
.h:75
#4  0x0000000801124188 in spa_load_impl (spa=3D0x803052c00, pool_guid=3D<va=
lue
optimized out>, config=3D0x803052ee8,=20
    state=3D<value optimized out>, type=3DSPA_IMPORT_EXISTING, mosconfig=3D=
B_TRUE)
    at
/usr/src/cddl/lib/libzpool/../../../sys/cddl/contrib/opensolaris/uts/common=
/fs/zfs/spa.c:2844
#5  0x000000080111ca68 in spa_load (spa=3D<value optimized out>, state=3D<v=
alue
optimized out>, type=3DSPA_IMPORT_EXISTING,=20
    mosconfig=3DB_TRUE) at
/usr/src/cddl/lib/libzpool/../../../sys/cddl/contrib/opensolaris/uts/common=
/fs/zfs/spa.c:2230
#6  0x0000000801123b51 in spa_load_impl (spa=3D0x803052c00, pool_guid=3D<va=
lue
optimized out>, config=3D0x803052ee8,=20
    state=3D<value optimized out>, type=3DSPA_IMPORT_EXISTING, mosconfig=3D=
B_FALSE)
    at
/usr/src/cddl/lib/libzpool/../../../sys/cddl/contrib/opensolaris/uts/common=
/fs/zfs/spa.c:2654
#7  0x000000080111ca68 in spa_load (spa=3D<value optimized out>, state=3D<v=
alue
optimized out>, type=3DSPA_IMPORT_EXISTING,=20
    mosconfig=3DB_FALSE) at
/usr/src/cddl/lib/libzpool/../../../sys/cddl/contrib/opensolaris/uts/common=
/fs/zfs/spa.c:2230
#8  0x000000080111c32a in spa_load_best (spa=3D0x803052c00, state=3DSPA_LOA=
D_OPEN,
mosconfig=3D0,=20
    max_request=3D<value optimized out>, rewind_flags=3D<value optimized ou=
t>)
    at
/usr/src/cddl/lib/libzpool/../../../sys/cddl/contrib/opensolaris/uts/common=
/fs/zfs/spa.c:3007
#9  0x0000000801118289 in spa_open_common (pool=3D<value optimized out>,
spapp=3D<value optimized out>, tag=3D0x801206642,=20
    nvpolicy=3D<value optimized out>, config=3D0x0)
    at
/usr/src/cddl/lib/libzpool/../../../sys/cddl/contrib/opensolaris/uts/common=
/fs/zfs/spa.c:3159
#10 0x0000000801142292 in dsl_pool_hold (name=3D<value optimized out>,
tag=3D0x801206642, dp=3D0x7fffffe5a958)
    at
/usr/src/cddl/lib/libzpool/../../../sys/cddl/contrib/opensolaris/uts/common=
/fs/zfs/dsl_pool.c:1111
#11 0x000000080116b29f in dmu_objset_own (name=3D0x7fffffffed87
"esx/userdata/workerX", type=3DDMU_OST_ANY,=20
    readonly=3DB_TRUE, tag=3D0x4107dd, osp=3D0x7fffffe5aa40)
    at
/usr/src/cddl/lib/libzpool/../../../sys/cddl/contrib/opensolaris/uts/common=
/fs/zfs/dmu_objset.c:570
#12 0x00000000004062b5 in main (argc=3D<value optimized out>, argv=3D<value
optimized out>)
    at
/usr/src/cddl/usr.sbin/zdb/../../../cddl/contrib/opensolaris/cmd/zdb/zdb.c:=
3792
#13 0x00000000004053df in _start ()
#14 0x0000000800638000 in ?? ()
#15 0x0000000000000000 in ?? ()
(gdb)

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-221060-8>