4087 (void) nvlist_remove_nvpair(props, pair);
4088 next:
4089 pair = next_pair;
4090 }
4091 }
4092
4093 /*
4094 * Extract properties that cannot be set PRIOR to the receipt of a dataset.
4095 * For example, refquota cannot be set until after the receipt of a dataset,
4096 * because a prior snapshot may exceed the refquota, and refquotas only apply
4097 * to the current dataset. The caller (libzfs) will manage these properties
4098 * somewhat as well to make sure they only come down with the last dataset in
4099 * a replication stream, but we still need to be safe about it here in
4100 * kernel-land.
4101 */
4102 static nvlist_t *
4103 extract_delay_props(nvlist_t *props)
4104 {
4105 nvlist_t *delayprops;
4106 nvpair_t *nvp, *tmp;
4107 static const zfs_prop_t delayable[] =
4108 { ZFS_PROP_REFQUOTA, ZFS_PROP_REFRESERVATION, 0 };
4109 boolean_t dontbother = B_TRUE;
4110 int i;
4111
4112 VERIFY(nvlist_alloc(&delayprops, NV_UNIQUE_NAME, KM_SLEEP) == 0);
4113
4114 for (nvp = nvlist_next_nvpair(props, NULL); nvp != NULL;
4115 nvp = nvlist_next_nvpair(props, nvp)) {
4116 /*
4117 * strcmp() is safe because zfs_prop_to_name() always returns
4118 * a bounded string.
4119 */
4120 for (i = 0; delayable[i] != 0; i++) {
4121 if (strcmp(zfs_prop_to_name(delayable[i]),
4122 nvpair_name(nvp)) == 0) {
4123 break;
4124 }
4125 }
4126 if (delayable[i] != 0) {
4127 tmp = nvlist_prev_nvpair(props, nvp);
4128 VERIFY(nvlist_add_nvpair(delayprops, nvp) == 0);
|
4087 (void) nvlist_remove_nvpair(props, pair);
4088 next:
4089 pair = next_pair;
4090 }
4091 }
4092
4093 /*
4094 * Extract properties that cannot be set PRIOR to the receipt of a dataset.
4095 * For example, refquota cannot be set until after the receipt of a dataset,
4096 * because a prior snapshot may exceed the refquota, and refquotas only apply
4097 * to the current dataset. The caller (libzfs) will manage these properties
4098 * somewhat as well to make sure they only come down with the last dataset in
4099 * a replication stream, but we still need to be safe about it here in
4100 * kernel-land.
4101 */
4102 static nvlist_t *
4103 extract_delay_props(nvlist_t *props)
4104 {
4105 nvlist_t *delayprops;
4106 nvpair_t *nvp, *tmp;
4107 static const zfs_prop_t delayable[] = { ZFS_PROP_REFQUOTA, 0 };
4108 boolean_t dontbother = B_TRUE;
4109 int i;
4110
4111 VERIFY(nvlist_alloc(&delayprops, NV_UNIQUE_NAME, KM_SLEEP) == 0);
4112
4113 for (nvp = nvlist_next_nvpair(props, NULL); nvp != NULL;
4114 nvp = nvlist_next_nvpair(props, nvp)) {
4115 /*
4116 * strcmp() is safe because zfs_prop_to_name() always returns
4117 * a bounded string.
4118 */
4119 for (i = 0; delayable[i] != 0; i++) {
4120 if (strcmp(zfs_prop_to_name(delayable[i]),
4121 nvpair_name(nvp)) == 0) {
4122 break;
4123 }
4124 }
4125 if (delayable[i] != 0) {
4126 tmp = nvlist_prev_nvpair(props, nvp);
4127 VERIFY(nvlist_add_nvpair(delayprops, nvp) == 0);
|