zfs.c (286822dd6ee35fa0959e7b55e659b92ea1c12f71) | zfs.c (842727c2f41f01b380de4f5e787d905702870f23) |
---|---|
1/* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE --- 657 unchanged lines hidden (view full) --- 666{ 667 /* If snapshot has clones, something is wrong */ 668 if (zfs_prop_get_int(zhp, ZFS_PROP_NUMCLONES) != 0) { 669 zfs_close(zhp); 670 return (1); 671 } 672 673 if (zfs_unmount(zhp, NULL, 0) == 0) { | 1/* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE --- 657 unchanged lines hidden (view full) --- 666{ 667 /* If snapshot has clones, something is wrong */ 668 if (zfs_prop_get_int(zhp, ZFS_PROP_NUMCLONES) != 0) { 669 zfs_close(zhp); 670 return (1); 671 } 672 673 if (zfs_unmount(zhp, NULL, 0) == 0) { |
674 (void) zfs_destroy(zhp); | 674 (void) zfs_destroy(zhp, B_FALSE); |
675 } 676 677 zfs_close(zhp); 678 return (0); 679} 680 681/* 682 * A ZFS snapshot iterator call-back function which renames snapshots. --- 273 unchanged lines hidden (view full) --- 956 } 957 zfs_close(zhp); 958 959 if (clone_snap(snap_name, clone_name) != Z_OK) { 960 /* Clean up the snapshot we just took. */ 961 if ((zhp = zfs_open(g_zfs, snap_name, ZFS_TYPE_SNAPSHOT)) 962 != NULL) { 963 if (zfs_unmount(zhp, NULL, 0) == 0) | 675 } 676 677 zfs_close(zhp); 678 return (0); 679} 680 681/* 682 * A ZFS snapshot iterator call-back function which renames snapshots. --- 273 unchanged lines hidden (view full) --- 956 } 957 zfs_close(zhp); 958 959 if (clone_snap(snap_name, clone_name) != Z_OK) { 960 /* Clean up the snapshot we just took. */ 961 if ((zhp = zfs_open(g_zfs, snap_name, ZFS_TYPE_SNAPSHOT)) 962 != NULL) { 963 if (zfs_unmount(zhp, NULL, 0) == 0) |
964 (void) zfs_destroy(zhp); | 964 (void) zfs_destroy(zhp, B_FALSE); |
965 zfs_close(zhp); 966 } 967 968 return (Z_ERR); 969 } 970 971 (void) printf(gettext("Instead of copying, a ZFS clone has been " 972 "created for this zone.\n")); --- 40 unchanged lines hidden (view full) --- 1013 return; 1014 } 1015 1016 nvlist_free(props); 1017 1018 if (zfs_mount(zhp, NULL, 0) != 0) { 1019 (void) fprintf(stderr, gettext("cannot mount ZFS dataset %s: " 1020 "%s\n"), zfs_name, libzfs_error_description(g_zfs)); | 965 zfs_close(zhp); 966 } 967 968 return (Z_ERR); 969 } 970 971 (void) printf(gettext("Instead of copying, a ZFS clone has been " 972 "created for this zone.\n")); --- 40 unchanged lines hidden (view full) --- 1013 return; 1014 } 1015 1016 nvlist_free(props); 1017 1018 if (zfs_mount(zhp, NULL, 0) != 0) { 1019 (void) fprintf(stderr, gettext("cannot mount ZFS dataset %s: " 1020 "%s\n"), zfs_name, libzfs_error_description(g_zfs)); |
1021 (void) zfs_destroy(zhp); | 1021 (void) zfs_destroy(zhp, B_FALSE); |
1022 } else { 1023 if (chmod(zonepath, S_IRWXU) != 0) { 1024 (void) fprintf(stderr, gettext("file system %s " 1025 "successfully created, but chmod %o failed: %s\n"), 1026 zfs_name, S_IRWXU, strerror(errno)); 1027 (void) destroy_zfs(zonepath); 1028 } else { 1029 (void) printf(gettext("A ZFS file system has been " --- 50 unchanged lines hidden (view full) --- 1080 1081 if (zfs_unmount(zhp, NULL, 0) != 0) { 1082 (void) fprintf(stderr, gettext("zfs unmount %s failed: %s\n"), 1083 zfs_get_name(zhp), libzfs_error_description(g_zfs)); 1084 zfs_close(zhp); 1085 return (Z_ERR); 1086 } 1087 | 1022 } else { 1023 if (chmod(zonepath, S_IRWXU) != 0) { 1024 (void) fprintf(stderr, gettext("file system %s " 1025 "successfully created, but chmod %o failed: %s\n"), 1026 zfs_name, S_IRWXU, strerror(errno)); 1027 (void) destroy_zfs(zonepath); 1028 } else { 1029 (void) printf(gettext("A ZFS file system has been " --- 50 unchanged lines hidden (view full) --- 1080 1081 if (zfs_unmount(zhp, NULL, 0) != 0) { 1082 (void) fprintf(stderr, gettext("zfs unmount %s failed: %s\n"), 1083 zfs_get_name(zhp), libzfs_error_description(g_zfs)); 1084 zfs_close(zhp); 1085 return (Z_ERR); 1086 } 1087 |
1088 if (zfs_destroy(zhp) != 0) { | 1088 if (zfs_destroy(zhp, B_FALSE) != 0) { |
1089 /* 1090 * If the destroy fails for some reason, try to remount 1091 * the file system so that we can use "rm -rf" to clean up 1092 * instead. 1093 */ 1094 (void) fprintf(stderr, gettext("zfs destroy %s failed: %s\n"), 1095 zfs_get_name(zhp), libzfs_error_description(g_zfs)); 1096 (void) zfs_mount(zhp, NULL, 0); --- 16 unchanged lines hidden (view full) --- 1113 1114 /* 1115 * Try to clean up the snapshot that the clone was taken from. 1116 */ 1117 if ((ohp = zfs_open(g_zfs, origin, 1118 ZFS_TYPE_SNAPSHOT)) != NULL) { 1119 if (zfs_iter_dependents(ohp, B_TRUE, has_dependent, 1120 NULL) == 0 && zfs_unmount(ohp, NULL, 0) == 0) | 1089 /* 1090 * If the destroy fails for some reason, try to remount 1091 * the file system so that we can use "rm -rf" to clean up 1092 * instead. 1093 */ 1094 (void) fprintf(stderr, gettext("zfs destroy %s failed: %s\n"), 1095 zfs_get_name(zhp), libzfs_error_description(g_zfs)); 1096 (void) zfs_mount(zhp, NULL, 0); --- 16 unchanged lines hidden (view full) --- 1113 1114 /* 1115 * Try to clean up the snapshot that the clone was taken from. 1116 */ 1117 if ((ohp = zfs_open(g_zfs, origin, 1118 ZFS_TYPE_SNAPSHOT)) != NULL) { 1119 if (zfs_iter_dependents(ohp, B_TRUE, has_dependent, 1120 NULL) == 0 && zfs_unmount(ohp, NULL, 0) == 0) |
1121 (void) zfs_destroy(ohp); | 1121 (void) zfs_destroy(ohp, B_FALSE); |
1122 zfs_close(ohp); 1123 } 1124 } 1125 1126 zfs_close(zhp); 1127 return (Z_OK); 1128} 1129 --- 184 unchanged lines hidden --- | 1122 zfs_close(ohp); 1123 } 1124 } 1125 1126 zfs_close(zhp); 1127 return (Z_OK); 1128} 1129 --- 184 unchanged lines hidden --- |