From: Brian Behlendorf Date: Thu, 2 Jul 2009 23:50:53 +0000 (-0700) Subject: Merge commit 'refs/top-bases/gcc-cast' into gcc-cast X-Git-Tag: zfs-0.4.5~59^2^2^2^2~2^2~2^2^2~12^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b095bf444a52cd5b899f15c94b480a64f3b286e0;p=zfs Merge commit 'refs/top-bases/gcc-cast' into gcc-cast Conflicts: cmd/zfs/zfs_main.c lib/libzfs/libzfs_dataset.c --- b095bf444a52cd5b899f15c94b480a64f3b286e0 diff --cc cmd/zfs/zfs_main.c index c73fb9321,0752a4772..fe0ca7598 --- a/cmd/zfs/zfs_main.c +++ b/cmd/zfs/zfs_main.c @@@ -1435,21 -1490,30 +1490,29 @@@ upgrade_set_callback(zfs_handle_t *zhp { upgrade_cbdata_t *cb = data; int version = zfs_prop_get_int(zhp, ZFS_PROP_VERSION); - - if (cb->cb_version >= ZPL_VERSION_FUID) { - int spa_version; - - if (zfs_spa_version(zhp, &spa_version) < 0) - return (-1); - - if (spa_version < SPA_VERSION_FUID) { - /* can't upgrade */ - (void) printf(gettext("%s: can not be upgraded; " - "the pool version needs to first be upgraded\nto " - "version %llu\n\n"), - zfs_get_name(zhp), SPA_VERSION_FUID); - cb->cb_numfailed++; - return (0); + int i; + static struct { int zplver; int spaver; } table[] = { + {ZPL_VERSION_FUID, SPA_VERSION_FUID}, + {ZPL_VERSION_USERSPACE, SPA_VERSION_USERSPACE}, + {0, 0} + }; + - + for (i = 0; table[i].zplver; i++) { + if (cb->cb_version >= table[i].zplver) { + int spa_version; + + if (zfs_spa_version(zhp, &spa_version) < 0) + return (-1); + + if (spa_version < table[i].spaver) { + /* can't upgrade */ + (void) printf(gettext("%s: can not be " + "upgraded; the pool version needs to first " + "be upgraded\nto version %d\n\n"), + zfs_get_name(zhp), table[i].spaver); + cb->cb_numfailed++; + return (0); + } } } @@@ -1561,9 -1627,9 +1626,9 @@@ zfs_do_upgrade(int argc, char **argv if (cb.cb_version == 0) cb.cb_version = ZPL_VERSION; ret = zfs_for_each(argc, argv, flags, ZFS_TYPE_FILESYSTEM, - NULL, NULL, upgrade_set_callback, &cb); + NULL, NULL, 0, upgrade_set_callback, &cb); (void) printf(gettext("%llu filesystems upgraded\n"), - cb.cb_numupgraded); + (u_longlong_t)cb.cb_numupgraded); if (cb.cb_numsamegraded) { (void) printf(gettext("%llu filesystems already at " "this version\n"), diff --cc module/zfs/zfs_ioctl.c index aa7ffb59d,07dd03c35..f74f5f9a8 --- a/module/zfs/zfs_ioctl.c +++ b/module/zfs/zfs_ioctl.c @@@ -2083,9 -2367,9 +2367,9 @@@ zfs_ioc_create(zfs_cmd_t *zc strchr(zc->zc_name, '%')) return (EINVAL); - if (zc->zc_nvlist_src != NULL && + if (zc->zc_nvlist_src != 0 && (error = get_nvlist(zc->zc_nvlist_src, zc->zc_nvlist_src_size, - &nvprops)) != 0) + zc->zc_iflags, &nvprops)) != 0) return (error); zct.zct_zplprops = NULL; @@@ -2227,31 -2491,25 +2491,25 @@@ zfs_ioc_snapshot(zfs_cmd_t *zc if (snapshot_namecheck(zc->zc_value, NULL, NULL) != 0) return (EINVAL); - if (zc->zc_nvlist_src != NULL && + if (zc->zc_nvlist_src != 0 && (error = get_nvlist(zc->zc_nvlist_src, zc->zc_nvlist_src_size, - &nvprops)) != 0) + zc->zc_iflags, &nvprops)) != 0) return (error); - error = dmu_objset_snapshot(zc->zc_name, zc->zc_value, recursive); + error = zfs_check_userprops(zc->zc_name, nvprops); + if (error) + goto out; - /* - * It would be nice to do this atomically. - */ - if (error == 0) { - struct snap_prop_arg snpa; - snpa.nvprops = nvprops; - snpa.snapname = zc->zc_value; - if (recursive) { - error = dmu_objset_find(zc->zc_name, - set_snap_props, &snpa, DS_FIND_CHILDREN); - if (error) { - (void) dmu_snapshots_destroy(zc->zc_name, - zc->zc_value); - } - } else { - error = set_snap_props(zc->zc_name, &snpa); - } + if (nvprops != NULL && nvlist_next_nvpair(nvprops, NULL) != NULL && + zfs_earlier_version(zc->zc_name, SPA_VERSION_SNAP_PROPS)) { + error = ENOTSUP; + goto out; } + + error = dmu_objset_snapshot(zc->zc_name, zc->zc_value, + nvprops, recursive); + + out: nvlist_free(nvprops); return (error); } @@@ -2482,9 -2728,9 +2728,9 @@@ zfs_ioc_recv(zfs_cmd_t *zc *tosnap = '\0'; tosnap++; - if (zc->zc_nvlist_src != NULL && + if (zc->zc_nvlist_src != 0 && (error = get_nvlist(zc->zc_nvlist_src, zc->zc_nvlist_src_size, - &props)) != 0) + zc->zc_iflags, &props)) != 0) return (error); fd = zc->zc_cookie;