|
36 | 36 | * Copyright (c) 2014 Integros [integros.com]
|
37 | 37 | * Copyright 2016 Toomas Soome <tsoome@me.com>
|
38 | 38 | * Copyright 2017 RackTop Systems.
|
39 |
| - * Copyright (c) 2017 Datto Inc. |
| 39 | + * Copyright (c) 2016 Actifio, Inc. All rights reserved. |
| 40 | + * Copyright (c) 2017, loli10K <ezomori.nozomu@gmail.com>. All rights reserved. |
40 | 41 | */
|
41 | 42 |
|
42 | 43 | #define __APPLE_API_PRIVATE
|
@@ -5315,6 +5316,7 @@ zfs_ioc_hold(const char *pool, nvlist_t *args, nvlist_t *errlist)
|
5315 | 5316 | static int
|
5316 | 5317 | zfs_ioc_get_holds(const char *snapname, nvlist_t *args, nvlist_t *outnvl)
|
5317 | 5318 | {
|
| 5319 | + ASSERT3P(args, ==, NULL); |
5318 | 5320 | return (dsl_dataset_get_holds(snapname, outnvl));
|
5319 | 5321 | }
|
5320 | 5322 |
|
@@ -5843,6 +5845,43 @@ zfs_ioc_osx_proxy_dataset(zfs_cmd_t *zc)
|
5843 | 5845 | return (error);
|
5844 | 5846 | }
|
5845 | 5847 |
|
| 5848 | +/* |
| 5849 | + * Sync the currently open TXG to disk for the specified pool. |
| 5850 | + * This is somewhat similar to 'zfs_sync()'. |
| 5851 | + * For cases that do not result in error this ioctl will wait for |
| 5852 | + * the currently open TXG to commit before returning back to the caller. |
| 5853 | + * |
| 5854 | + * innvl: { |
| 5855 | + * "force" -> when true, force uberblock update even if there is no dirty data. |
| 5856 | + * In addition this will cause the vdev configuration to be written |
| 5857 | + * out including updating the zpool cache file. (boolean_t) |
| 5858 | + * } |
| 5859 | + * |
| 5860 | + * onvl is unused |
| 5861 | + */ |
| 5862 | +/* ARGSUSED */ |
| 5863 | +static int |
| 5864 | +zfs_ioc_pool_sync(const char *pool, nvlist_t *innvl, nvlist_t *onvl) |
| 5865 | +{ |
| 5866 | + int err; |
| 5867 | + boolean_t force; |
| 5868 | + spa_t *spa; |
| 5869 | + |
| 5870 | + if ((err = spa_open(pool, &spa, FTAG)) != 0) |
| 5871 | + return (err); |
| 5872 | + |
| 5873 | + force = fnvlist_lookup_boolean_value(innvl, "force"); |
| 5874 | + if (force) { |
| 5875 | + spa_config_enter(spa, SCL_CONFIG, FTAG, RW_WRITER); |
| 5876 | + vdev_config_dirty(spa->spa_root_vdev); |
| 5877 | + spa_config_exit(spa, SCL_CONFIG, FTAG); |
| 5878 | + } |
| 5879 | + txg_wait_synced(spa_get_dsl(spa), 0); |
| 5880 | + |
| 5881 | + spa_close(spa, FTAG); |
| 5882 | + |
| 5883 | + return (err); |
| 5884 | +} |
5846 | 5885 |
|
5847 | 5886 | static zfs_ioc_vec_t zfs_ioc_vec[ZFS_IOC_LAST - ZFS_IOC_FIRST];
|
5848 | 5887 |
|
@@ -6045,6 +6084,10 @@ zfs_ioctl_init(void)
|
6045 | 6084 | POOL_NAME, POOL_CHECK_SUSPENDED | POOL_CHECK_READONLY, B_TRUE,
|
6046 | 6085 | B_TRUE);
|
6047 | 6086 |
|
| 6087 | + zfs_ioctl_register("sync", ZFS_IOC_POOL_SYNC, |
| 6088 | + zfs_ioc_pool_sync, zfs_secpolicy_none, POOL_NAME, |
| 6089 | + POOL_CHECK_SUSPENDED | POOL_CHECK_READONLY, B_FALSE, B_FALSE); |
| 6090 | + |
6048 | 6091 | /* IOCTLS that use the legacy function signature */
|
6049 | 6092 |
|
6050 | 6093 | zfs_ioctl_register_legacy(ZFS_IOC_POOL_FREEZE, zfs_ioc_pool_freeze,
|
|
0 commit comments