| Summary: | [ZFS] Can't resume a zfs receive stream to a dataset with a mounted clone | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | Base System | Reporter: | Alan Somers <asomers> | ||||||
| Component: | bin | Assignee: | Alan Somers <asomers> | ||||||
| Status: | Closed FIXED | ||||||||
| Severity: | Affects Many People | CC: | mmacy | ||||||
| Priority: | --- | ||||||||
| Version: | 12.1-STABLE | ||||||||
| Hardware: | Any | ||||||||
| OS: | Any | ||||||||
| Attachments: |
|
||||||||
|
Description
Alan Somers
2020-09-24 16:14:42 UTC
Created attachment 218246 [details]
In iter_dependents_cb, don't recurse into clones of the destination
I'm guessing that https://github.com/openzfs/zfs/commit/0c6d09361d is the reason why I can't reproduce this problem on head. But I still don't know why OpenZFS isn't vulnerable to bug 248606 . That patch works, but unfortunately breaks the ability to do "zfs destroy -R" of a snapshot with clones. Created attachment 218303 [details] Fix unmount/remount when resuming a receive stream 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 Test Plan: ZFS test suite (In reply to Alan Somers from comment #4) Based on my understanding of the code and your description of the problem this change looks fine to me. A commit references this bug: Author: asomers Date: Sat Sep 26 02:50:29 UTC 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 Changes: stable/12/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c |