Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 1 Nov 2023 09:29:46 GMT
From:      Martin Matuska <mm@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: c5eb93ef57f4 - stable/14 - zfs: cherry-pick change from master
Message-ID:  <202311010929.3A19TkvM099503@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/14 has been updated by mm:

URL: https://cgit.FreeBSD.org/src/commit/?id=c5eb93ef57f4905f7aea9566ab45be1a75ada150

commit c5eb93ef57f4905f7aea9566ab45be1a75ada150
Author:     Martin Matuska <mm@FreeBSD.org>
AuthorDate: 2023-10-31 20:49:41 +0000
Commit:     Martin Matuska <mm@FreeBSD.org>
CommitDate: 2023-11-01 09:29:34 +0000

    zfs: cherry-pick change from master
    
     #15465 763ca47f Fix block cloning between unencrypted and encrypted
                     datasets
    
    Fixes a kernel panic when block cloning is enabled and system is trying
    to read data from a file copied using copy_file_range(2), e.g. with cp(1)
    from an unencrypted dataset into an encrypted dataset on the same ZFS pool.
    As the file has not been encrypted, to fix the filesystem inconsistency
    and to avoid future panics it must be deleted (metadata is readable).
    
    Obtained from:  OpenZFS
    OpenZFS commit: 763ca47fa81808be62ab5e02357e896233f24abc
---
 sys/contrib/openzfs/module/zfs/zfs_vnops.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/sys/contrib/openzfs/module/zfs/zfs_vnops.c b/sys/contrib/openzfs/module/zfs/zfs_vnops.c
index 40d6c87a754e..84e6b10ef37c 100644
--- a/sys/contrib/openzfs/module/zfs/zfs_vnops.c
+++ b/sys/contrib/openzfs/module/zfs/zfs_vnops.c
@@ -1094,6 +1094,15 @@ zfs_clone_range(znode_t *inzp, uint64_t *inoffp, znode_t *outzp,
 
 	ASSERT(!outzfsvfs->z_replay);
 
+	/*
+	 * Block cloning from an unencrypted dataset into an encrypted
+	 * dataset and vice versa is not supported.
+	 */
+	if (inos->os_encrypted != outos->os_encrypted) {
+		zfs_exit_two(inzfsvfs, outzfsvfs, FTAG);
+		return (SET_ERROR(EXDEV));
+	}
+
 	error = zfs_verify_zp(inzp);
 	if (error == 0)
 		error = zfs_verify_zp(outzp);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202311010929.3A19TkvM099503>