Steven Hartland via illumos-zfs
2014-09-29 19:49:35 UTC
I've just spotted what looks like a possible miss-merge of:
4369 implement zfs bookmarks
It seems we've lost the snap must be in the specified pool
check as well as the check for error on unmount which was
specifically added by:
3744 zfs shouldn't ignore errors unmounting snapshots
Both seem a little odd.
https://github.com/illumos/illumos-gate/commit/78f171005391b928aaf1642b3206c534ed644332#diff-6296d5738a0663ee611fea974d51e0ca
Prior to this commit this we had:-
static int
zfs_ioc_destroy_snaps(const char *poolname, nvlist_t *innvl, nvlist_t *outnvl)
{
int error, poollen;
nvlist_t *snaps;
nvpair_t *pair;
boolean_t defer;
if (nvlist_lookup_nvlist(innvl, "snaps", &snaps) != 0)
return (SET_ERROR(EINVAL));
defer = nvlist_exists(innvl, "defer");
poollen = strlen(poolname);
for (pair = nvlist_next_nvpair(snaps, NULL); pair != NULL;
pair = nvlist_next_nvpair(snaps, pair)) {
const char *name = nvpair_name(pair);
/*
* The snap must be in the specified pool.
*/
if (strncmp(name, poolname, poollen) != 0 ||
(name[poollen] != '/' && name[poollen] != '@'))
return (SET_ERROR(EXDEV));
error = zfs_unmount_snap(name);
if (error != 0)
return (error);
}
return (dsl_destroy_snapshots_nvl(snaps, defer, outnvl));
}
After it we have:
zfs_ioc_destroy_snaps(const char *poolname, nvlist_t *innvl, nvlist_t *outnvl)
{
nvlist_t *snaps;
nvpair_t *pair;
boolean_t defer;
if (nvlist_lookup_nvlist(innvl, "snaps", &snaps) != 0)
return (SET_ERROR(EINVAL));
defer = nvlist_exists(innvl, "defer");
for (pair = nvlist_next_nvpair(snaps, NULL); pair != NULL;
pair = nvlist_next_nvpair(snaps, pair)) {
(void) zfs_unmount_snap(nvpair_name(pair));
}
return (dsl_destroy_snapshots_nvl(snaps, defer, outnvl));
}
4369 implement zfs bookmarks
It seems we've lost the snap must be in the specified pool
check as well as the check for error on unmount which was
specifically added by:
3744 zfs shouldn't ignore errors unmounting snapshots
Both seem a little odd.
https://github.com/illumos/illumos-gate/commit/78f171005391b928aaf1642b3206c534ed644332#diff-6296d5738a0663ee611fea974d51e0ca
Prior to this commit this we had:-
static int
zfs_ioc_destroy_snaps(const char *poolname, nvlist_t *innvl, nvlist_t *outnvl)
{
int error, poollen;
nvlist_t *snaps;
nvpair_t *pair;
boolean_t defer;
if (nvlist_lookup_nvlist(innvl, "snaps", &snaps) != 0)
return (SET_ERROR(EINVAL));
defer = nvlist_exists(innvl, "defer");
poollen = strlen(poolname);
for (pair = nvlist_next_nvpair(snaps, NULL); pair != NULL;
pair = nvlist_next_nvpair(snaps, pair)) {
const char *name = nvpair_name(pair);
/*
* The snap must be in the specified pool.
*/
if (strncmp(name, poolname, poollen) != 0 ||
(name[poollen] != '/' && name[poollen] != '@'))
return (SET_ERROR(EXDEV));
error = zfs_unmount_snap(name);
if (error != 0)
return (error);
}
return (dsl_destroy_snapshots_nvl(snaps, defer, outnvl));
}
After it we have:
zfs_ioc_destroy_snaps(const char *poolname, nvlist_t *innvl, nvlist_t *outnvl)
{
nvlist_t *snaps;
nvpair_t *pair;
boolean_t defer;
if (nvlist_lookup_nvlist(innvl, "snaps", &snaps) != 0)
return (SET_ERROR(EINVAL));
defer = nvlist_exists(innvl, "defer");
for (pair = nvlist_next_nvpair(snaps, NULL); pair != NULL;
pair = nvlist_next_nvpair(snaps, pair)) {
(void) zfs_unmount_snap(nvpair_name(pair));
}
return (dsl_destroy_snapshots_nvl(snaps, defer, outnvl));
}