diff options
author | avg <avg@FreeBSD.org> | 2015-05-25 11:56:57 +0000 |
---|---|---|
committer | avg <avg@FreeBSD.org> | 2015-05-25 11:56:57 +0000 |
commit | 2c52296aaa76fb2fba542afba29865f67b00663a (patch) | |
tree | 75ac2a3991f2da1b940fb2fd92b235f1a5223259 | |
parent | 511007870defd6aca8d20ca92d6caf30c364ee56 (diff) | |
download | FreeBSD-src-2c52296aaa76fb2fba542afba29865f67b00663a.zip FreeBSD-src-2c52296aaa76fb2fba542afba29865f67b00663a.tar.gz |
zfs: fixes for a full stream received into an existing dataset
- this should fail early unless the force flag is set
- if the force flag is set then any local modifications including
snapshots should be undone
See: https://www.illumos.org/issues/5912
See: https://reviews.csiden.org/r/220/
Reviewed by: mahrens, Paul Dagnelie <pcd@delphix.com>
MFC after: 15 days
Sponsored by: ClusterHQ
-rw-r--r-- | sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c index a0c1377..adee4f8 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c @@ -983,10 +983,12 @@ recv_begin_check_existing_impl(dmu_recv_begin_arg_t *drba, dsl_dataset_t *ds, dsl_dataset_rele(snap, FTAG); } else { - /* if full, most recent snapshot must be $ORIGIN */ - if (dsl_dataset_phys(ds)->ds_prev_snap_txg >= TXG_INITIAL) - return (SET_ERROR(ENODEV)); - drba->drba_snapobj = dsl_dataset_phys(ds)->ds_prev_snap_obj; + /* if full, then must be forced */ + if (!drba->drba_cookie->drc_force) + return (SET_ERROR(EEXIST)); + /* start from $ORIGIN@$ORIGIN, if supported */ + drba->drba_snapobj = dp->dp_origin_snap != NULL ? + dp->dp_origin_snap->ds_object : 0; } return (0); |