K 10 svn:author V 7 asomers K 8 svn:date V 27 2020-09-26T02:50:28.849582Z K 7 svn:log V 1267 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 END