ZVOLs should not be allowed to have children
authorloli10K <loli10K@users.noreply.github.com>
Fri, 8 Feb 2019 23:44:15 +0000 (00:44 +0100)
committerMatthew Ahrens <mahrens@delphix.com>
Fri, 8 Feb 2019 23:44:15 +0000 (15:44 -0800)
commitd8d418ff0cc90776182534bce10b01e9487b63e4
treeb7db149cf6bfc701f7b3637359c192b2575c83c8
parent4417096956f7439322c65d9e70a4526df45ea8d0
ZVOLs should not be allowed to have children

zfs create, receive and rename can bypass this hierarchy rule. Update
both userland and kernel module to prevent this issue and use pyzfs
unit tests to exercise the ioctls directly.

Note: this commit slightly changes zfs_ioc_create() ABI. This allow to
differentiate a generic error (EINVAL) from the specific case where we
tried to create a dataset below a ZVOL (ZFS_ERR_WRONG_PARENT).

Reviewed-by: Paul Dagnelie <pcd@delphix.com>
Reviewed-by: Matt Ahrens <mahrens@delphix.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Tom Caputi <tcaputi@datto.com>
Signed-off-by: loli10K <ezomori.nozomu@gmail.com>
17 files changed:
contrib/pyzfs/libzfs_core/_constants.py
contrib/pyzfs/libzfs_core/_error_translation.py
contrib/pyzfs/libzfs_core/_libzfs_core.py
contrib/pyzfs/libzfs_core/exceptions.py
contrib/pyzfs/libzfs_core/test/test_libzfs_core.py
include/libzfs.h
include/sys/fs/zfs.h
lib/libzfs/libzfs_dataset.c
lib/libzfs/libzfs_sendrecv.c
lib/libzfs/libzfs_util.c
module/zfs/dmu_objset.c
module/zfs/dmu_recv.c
module/zfs/dsl_dir.c
module/zfs/zfs_ioctl.c
tests/runfiles/linux.run
tests/zfs-tests/tests/functional/zvol/zvol_misc/Makefile.am
tests/zfs-tests/tests/functional/zvol/zvol_misc/zvol_misc_hierarchy.ksh [new file with mode: 0755]