summaryrefslogtreecommitdiffstats
path: root/module
diff options
context:
space:
mode:
authorBrian Behlendorf <[email protected]>2013-12-13 14:49:33 -0800
committerBrian Behlendorf <[email protected]>2013-12-16 09:41:39 -0800
commit2e0358cbcab49f7be18762e8cb51e642188709e7 (patch)
tree2704cd15588e782e07e9361d458030250cd43730 /module
parentba6a24026c6eb910188c24b5c921fb793d3c998e (diff)
Sync /dev/zfs ioctl ordering
In order to minimize any future disruption caused by the addition and removal /dev/zfs ioctls this patch makes the following changes. 1) Sync ZoL's ioctl ordering such that it matches Illumos. For historic reasons the ZFS_IOC_DESTROY_SNAPS and ZFS_IOC_POOL_REGUID ioctls were out of order. 2) Move Linux and FreeBSD specific ioctls in to their own reserved ranges. This allows us to preserve the existing ordering when new ioctls are added by either Illumos or FreeBSD. When an ioctl is no longer needed it should be retired in place. This change alters the ZFS user/kernel ABI so make sure you rebuild both your user and kernel modules. However, it should allow for a much stabler interface going forward. Signed-off-by: Brian Behlendorf <[email protected]> Signed-off-by: Ned Bass <[email protected]> Closes #1973
Diffstat (limited to 'module')
-rw-r--r--module/zfs/zfs_ioctl.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/module/zfs/zfs_ioctl.c b/module/zfs/zfs_ioctl.c
index 9b084632f..924151480 100644
--- a/module/zfs/zfs_ioctl.c
+++ b/module/zfs/zfs_ioctl.c
@@ -5565,6 +5565,13 @@ zfsdev_ioctl(struct file *filp, unsigned cmd, unsigned long arg)
return (-SET_ERROR(EINVAL));
vec = &zfs_ioc_vec[vecnum];
+ /*
+ * The registered ioctl list may be sparse, verify that either
+ * a normal or legacy handler are registered.
+ */
+ if (vec->zvec_func == NULL && vec->zvec_legacy_func == NULL)
+ return (-SET_ERROR(EINVAL));
+
zc = kmem_zalloc(sizeof (zfs_cmd_t), KM_SLEEP | KM_NODEBUG);
saved_poolname = kmem_alloc(MAXNAMELEN, KM_SLEEP);