--- a/usr/src/uts/common/fs/zfs/dsl_dataset.c Wed Aug 05 23:09:01 2009 -0700
+++ b/usr/src/uts/common/fs/zfs/dsl_dataset.c Thu Aug 06 09:10:03 2009 -0600
@@ -3470,6 +3470,7 @@
char *htag;
char *snapname;
boolean_t recursive;
+ boolean_t gotone;
char failed[MAXPATHLEN];
};
@@ -3489,6 +3490,7 @@
error = dsl_dataset_hold(name, ha->dstg, &ds);
kmem_free(name, buflen);
if (error == 0) {
+ ha->gotone = B_TRUE;
dsl_sync_task_create(ha->dstg, dsl_dataset_user_hold_check,
dsl_dataset_user_hold_sync, ds, ha->htag, 0);
} else if (error == ENOENT && ha->recursive) {
@@ -3542,6 +3544,9 @@
dsl_dataset_rele(ds, ha->dstg);
}
+ if (error == 0 && recursive && !ha->gotone)
+ error = ENOENT;
+
if (error)
(void) strcpy(dsname, ha->failed);
@@ -3692,6 +3697,8 @@
if (error)
return (error);
+ ha->gotone = B_TRUE;
+
ASSERT(dsl_dataset_is_snapshot(ds));
error = dsl_dataset_release_might_destroy(ds, ha->htag, &might_destroy);
@@ -3781,6 +3788,9 @@
kmem_free(ra, sizeof (struct dsl_ds_releasearg));
}
+ if (error == 0 && recursive && !ha->gotone)
+ error = ENOENT;
+
if (error)
(void) strcpy(dsname, ha->failed);