summaryrefslogtreecommitdiff
path: root/usr/src/lib/libzfs/common/libzfs_dataset.c
diff options
context:
space:
mode:
authorChris Kirby <Chris.Kirby@sun.com>2010-02-24 09:58:00 -0700
committerChris Kirby <Chris.Kirby@sun.com>2010-02-24 09:58:00 -0700
commit54a91118eee5bfd63eb614a44e1b68f1571a99ea (patch)
tree24a917c2617c05449430f2781a1b69f8a6f32003 /usr/src/lib/libzfs/common/libzfs_dataset.c
parentada693c472e1e4542e03a2d63b2b935314a1899d (diff)
downloadillumos-joyent-54a91118eee5bfd63eb614a44e1b68f1571a99ea.tar.gz
6505339 dsl_pool_close() needs to call txg_list_destroy(&dp->dp_sync_tasks) to be nice
6569720 zpool import -d <readonly filesystem> <pool> core dumps 6566868 'zinject -c all' should not permit by regular user 6561382 zpl version incompatability needs better error messaging 6909405 concurrent replication actions fail to destroy each others' snapshots 6794306 df.c calls libzfs_init with an argument when none is expected
Diffstat (limited to 'usr/src/lib/libzfs/common/libzfs_dataset.c')
-rw-r--r--usr/src/lib/libzfs/common/libzfs_dataset.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/usr/src/lib/libzfs/common/libzfs_dataset.c b/usr/src/lib/libzfs/common/libzfs_dataset.c
index bd63372301..e9725e96b4 100644
--- a/usr/src/lib/libzfs/common/libzfs_dataset.c
+++ b/usr/src/lib/libzfs/common/libzfs_dataset.c
@@ -4018,6 +4018,8 @@ struct hold_range_arg {
boolean_t seenfrom;
boolean_t holding;
boolean_t recursive;
+ snapfilter_cb_t *filter_cb;
+ void *filter_cb_arg;
};
static int
@@ -4039,6 +4041,15 @@ zfs_hold_range_one(zfs_handle_t *zhp, void *arg)
return (0);
}
+ if (!hra->seento && strcmp(hra->tosnap, thissnap) == 0)
+ hra->seento = B_TRUE;
+
+ if (hra->filter_cb != NULL &&
+ hra->filter_cb(zhp, hra->filter_cb_arg) == B_FALSE) {
+ zfs_close(zhp);
+ return (0);
+ }
+
if (hra->holding) {
/* We could be racing with destroy, so ignore ENOENT. */
error = zfs_hold(hra->origin, thissnap, hra->tag,
@@ -4052,9 +4063,6 @@ zfs_hold_range_one(zfs_handle_t *zhp, void *arg)
hra->recursive);
}
- if (!hra->seento && strcmp(hra->tosnap, thissnap) == 0)
- hra->seento = B_TRUE;
-
zfs_close(zhp);
return (error);
}
@@ -4066,7 +4074,8 @@ zfs_hold_range_one(zfs_handle_t *zhp, void *arg)
*/
int
zfs_hold_range(zfs_handle_t *zhp, const char *fromsnap, const char *tosnap,
- const char *tag, boolean_t recursive, boolean_t temphold)
+ const char *tag, boolean_t recursive, boolean_t temphold,
+ snapfilter_cb_t filter_cb, void *cbarg)
{
struct hold_range_arg arg = { 0 };
int error;
@@ -4079,6 +4088,8 @@ zfs_hold_range(zfs_handle_t *zhp, const char *fromsnap, const char *tosnap,
arg.holding = B_TRUE;
arg.recursive = recursive;
arg.seenfrom = (fromsnap == NULL);
+ arg.filter_cb = filter_cb;
+ arg.filter_cb_arg = cbarg;
error = zfs_iter_snapshots_sorted(zhp, zfs_hold_range_one, &arg);