]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
zfs: Fix resuming receive stream to dataset with mounted clone
authorAlan Somers <asomers@FreeBSD.org>
Sat, 26 Sep 2020 02:50:28 +0000 (02:50 +0000)
committerAlan Somers <asomers@FreeBSD.org>
Sat, 26 Sep 2020 02:50:28 +0000 (02:50 +0000)
commit3cfb9a8386efee3fbdfd3b41cf2b512c1ffccc73
treeb178acb458f5e9604b926446474fc4fe5b600085
parent0e08a5eff95479be0a614fa9e783162a7596ae01
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
cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c