From 3541dc6d02592bd0939ea2d35b50c2bbdcc4cd0e Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Fri, 11 Nov 2011 14:07:54 -0800 Subject: Illumos #1748: desire support for reguid in zfs Reviewed by: George Wilson Reviewed by: Igor Kozhukhov Reviewed by: Alexander Eremin Reviewed by: Alexander Stetsenko Approved by: Richard Lowe References: https://www.illumos.org/issues/1748 This commit modifies the user to kernel space ioctl ABI. Extra care should be taken when updating to ensure both the kernel modules and utilities are updated. If only the user space component is updated both the 'zpool events' command and the 'zpool reguid' command will not work until the kernel modules are updated. Ported by: Martin Matuska Signed-off-by: Brian Behlendorf Closes #665 --- module/zfs/zfs_ioctl.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'module/zfs/zfs_ioctl.c') diff --git a/module/zfs/zfs_ioctl.c b/module/zfs/zfs_ioctl.c index a232ed0d5..65b0a1975 100644 --- a/module/zfs/zfs_ioctl.c +++ b/module/zfs/zfs_ioctl.c @@ -24,6 +24,10 @@ * Portions Copyright 2012 Pawel Jakub Dawidek * Copyright (c) 2012, Joyent, Inc. All rights reserved. */ +/* + * Copyright 2011 Nexenta Systems, Inc. All rights reserved. + * Copyright (c) 2011 by Delphix. All rights reserved. + */ #include #include @@ -1427,6 +1431,20 @@ zfs_ioc_pool_get_history(zfs_cmd_t *zc) return (error); } +static int +zfs_ioc_pool_reguid(zfs_cmd_t *zc) +{ + spa_t *spa; + int error; + + error = spa_open(zc->zc_name, &spa, FTAG); + if (error == 0) { + error = spa_change_guid(spa); + spa_close(spa, FTAG); + } + return (error); +} + static int zfs_ioc_dsobj_to_dsname(zfs_cmd_t *zc) { @@ -4698,10 +4716,12 @@ static zfs_ioc_vec_t zfs_ioc_vec[] = { B_FALSE, POOL_CHECK_SUSPENDED | POOL_CHECK_READONLY }, { zfs_ioc_obj_to_stats, zfs_secpolicy_diff, DATASET_NAME, B_FALSE, POOL_CHECK_SUSPENDED }, + { zfs_ioc_pool_reguid, zfs_secpolicy_config, POOL_NAME, B_TRUE, + POOL_CHECK_SUSPENDED | POOL_CHECK_READONLY }, { zfs_ioc_events_next, zfs_secpolicy_config, NO_NAME, B_FALSE, POOL_CHECK_NONE }, { zfs_ioc_events_clear, zfs_secpolicy_config, NO_NAME, B_FALSE, - POOL_CHECK_NONE }, + POOL_CHECK_NONE } }; int -- cgit v1.2.3