From 16e9ce85d4feafcf0ff4ca26595f10b9b9c7fc09 Mon Sep 17 00:00:00 2001 From: Alan Somers Date: Sun, 30 Aug 2020 16:27:58 +0000 Subject: [PATCH] MFC r364412: zfs: fix EIO accessing dataset after resuming interrupted receive ZFS unmounts a dataset while receiving into it and remounts it afterwards. But if ZFS is resuming an incomplete receive, it screws up and ends up with a dataset that is mounted, but returns EIO for every access. This commit fixes that condition. While the vulnerable code also exists in OpenZFS, the problem is not reproducible there. Apparently OpenZFS doesn't unmount the destination dataset during receive, like FreeBSD does. PR: 248606 Reviewed by: mmacy Sponsored by: Axcient Differential Revision: https://reviews.freebsd.org/D26034 --- cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c b/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c index e6f654b25b5..55556d7b037 100644 --- a/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c +++ b/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c @@ -3433,7 +3433,7 @@ zfs_receive_one(libzfs_handle_t *hdl, int infd, const char *tosnap, } if (!flags->dryrun && zhp->zfs_type == ZFS_TYPE_FILESYSTEM && - stream_wantsnewfs) { + (stream_wantsnewfs || resuming)) { /* We can't do online recv in this case */ clp = changelist_gather(zhp, ZFS_PROP_NAME, 0, 0); if (clp == NULL) { -- 2.45.0