Author: asomers Date: Sat Sep 26 02:50:28 2020 New Revision: 366180 URL: https://svnweb.freebsd.org/changeset/base/366180
Log: zfs: Fix resuming receive stream to dataset with mounted clone My fix for bug 248606 (zfs receive: Input/output error accessing dataset after resuming interrupted receive), r364412, introduced a regression: attempting to resume a receive into a dataset with a mounted clone would fail if that clone were in-use. This change reverts r364412 and fixes it in a better way. Background: When ZFS receives a stream, it may decide to unmount and remount the destination and all of its children. However, ever since resumable send/receive was implemented, ZFS has skipped the unmount/remount step when resuming a stream. I don't know why. That let to bug 248606. When resuming the stream, ZFS didn't unmount and remount the destination, leaving a destroyed dataset mounted. My original fix was to always unmount and remount when resuming a receive, but that caused other problems, like bug 249579. A better solution is to unmount and remount when resuming a receive of a stream that would've unmounted and remounted when it was new. Direct commit to stable/12 because head has moved to OpenZFS. The bug exists there, too, but a change to the OpenZFS code can't be merged to the old ZFS code. PR: 249579 Reviewed by: mmacy MFC after: 1 week Sponsored by: Axcient Modified: stable/12/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c Modified: stable/12/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c ============================================================================== --- stable/12/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c Sat Sep 26 00:58:27 2020 (r366179) +++ stable/12/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c Sat Sep 26 02:50:28 2020 (r366180) @@ -3301,7 +3301,7 @@ zfs_receive_one(libzfs_handle_t *hdl, int infd, const boolean_t resuming = DMU_GET_FEATUREFLAGS(drrb->drr_versioninfo) & DMU_BACKUP_FEATURE_RESUMING; stream_wantsnewfs = (drrb->drr_fromguid == 0 || - (drrb->drr_flags & DRR_FLAG_CLONE) || originsnap) && !resuming; + (drrb->drr_flags & DRR_FLAG_CLONE) || originsnap); if (stream_wantsnewfs) { /* @@ -3433,7 +3433,7 @@ zfs_receive_one(libzfs_handle_t *hdl, int infd, const } if (!flags->dryrun && zhp->zfs_type == ZFS_TYPE_FILESYSTEM && - (stream_wantsnewfs || resuming)) { + stream_wantsnewfs) { /* We can't do online recv in this case */ clp = changelist_gather(zhp, ZFS_PROP_NAME, 0, 0); if (clp == NULL) { _______________________________________________ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"