Skip to content

Commit

Permalink
5909 ensure that shared snap names don't become too long after promotion
Browse files Browse the repository at this point in the history
Reviewed by: Matthew Ahrens <[email protected]>
Reviewed by: George Wilson <[email protected]>
Approved by: Dan McDonald <[email protected]>
  • Loading branch information
avg-I authored and ahrens committed May 27, 2015
1 parent beddaa9 commit cb5842f
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions usr/src/uts/common/fs/zfs/dsl_dataset.c
Original file line number Diff line number Diff line change
Expand Up @@ -2099,12 +2099,14 @@ dsl_dataset_promote_check(void *arg, dmu_tx_t *tx)
int err;
uint64_t unused;
uint64_t ss_mv_cnt;
size_t max_snap_len;

err = promote_hold(ddpa, dp, FTAG);
if (err != 0)
return (err);

hds = ddpa->ddpa_clone;
max_snap_len = MAXNAMELEN - strlen(ddpa->ddpa_clonename) - 1;

if (dsl_dataset_phys(hds)->ds_flags & DS_FLAG_NOPROMOTE) {
promote_rele(ddpa, FTAG);
Expand Down Expand Up @@ -2168,6 +2170,10 @@ dsl_dataset_promote_check(void *arg, dmu_tx_t *tx)

/* Check that the snapshot name does not conflict */
VERIFY0(dsl_dataset_get_snapname(ds));
if (strlen(ds->ds_snapname) >= max_snap_len) {
err = SET_ERROR(ENAMETOOLONG);
goto out;
}
err = dsl_dataset_snap_lookup(hds, ds->ds_snapname, &val);
if (err == 0) {
(void) strcpy(ddpa->err_ds, snap->ds->ds_snapname);
Expand Down

0 comments on commit cb5842f

Please sign in to comment.