Lines 265-270
be_destroy(libbe_handle_t *lbh, const char *name, int options)
Link Here
|
265 |
zfs_prop_get(fs, ZFS_PROP_ORIGIN, origin, sizeof(origin), |
265 |
zfs_prop_get(fs, ZFS_PROP_ORIGIN, origin, sizeof(origin), |
266 |
NULL, NULL, 0, 1) != 0) |
266 |
NULL, NULL, 0, 1) != 0) |
267 |
return (set_error(lbh, BE_ERR_NOORIGIN)); |
267 |
return (set_error(lbh, BE_ERR_NOORIGIN)); |
|
|
268 |
|
269 |
/* Don't destroy a mounted dataset unless force is specified */ |
270 |
if ((mounted = zfs_is_mounted(fs, NULL)) != 0) { |
271 |
if (force) { |
272 |
zfs_unmount(fs, NULL, 0); |
273 |
} else { |
274 |
free(bdd.snapname); |
275 |
return (set_error(lbh, BE_ERR_DESTROYMNT)); |
276 |
} |
277 |
} |
268 |
} else { |
278 |
} else { |
269 |
if (!zfs_dataset_exists(lbh->lzh, path, ZFS_TYPE_SNAPSHOT)) |
279 |
if (!zfs_dataset_exists(lbh->lzh, path, ZFS_TYPE_SNAPSHOT)) |
270 |
return (set_error(lbh, BE_ERR_NOENT)); |
280 |
return (set_error(lbh, BE_ERR_NOENT)); |
Lines 280-295
be_destroy(libbe_handle_t *lbh, const char *name, int options)
Link Here
|
280 |
} |
290 |
} |
281 |
} |
291 |
} |
282 |
|
292 |
|
283 |
/* Check if mounted, unmount if force is specified */ |
|
|
284 |
if ((mounted = zfs_is_mounted(fs, NULL)) != 0) { |
285 |
if (force) { |
286 |
zfs_unmount(fs, NULL, 0); |
287 |
} else { |
288 |
free(bdd.snapname); |
289 |
return (set_error(lbh, BE_ERR_DESTROYMNT)); |
290 |
} |
291 |
} |
292 |
|
293 |
err = be_destroy_cb(fs, &bdd); |
293 |
err = be_destroy_cb(fs, &bdd); |
294 |
zfs_close(fs); |
294 |
zfs_close(fs); |
295 |
free(bdd.snapname); |
295 |
free(bdd.snapname); |