diff -Nru zfs-linux-2.3.2/debian/changelog zfs-linux-2.3.2/debian/changelog --- zfs-linux-2.3.2/debian/changelog 2025-05-02 17:46:51.000000000 +0800 +++ zfs-linux-2.3.2/debian/changelog 2025-06-29 21:54:37.000000000 +0800 @@ -1,3 +1,10 @@ +zfs-linux (2.3.2-2) UNRELEASED; urgency=medium + + * d/patches: backport some fixes from 2.3.3 upstream release + (closes: #1106035). + + -- Shengqi Chen Sun, 29 Jun 2025 21:54:37 +0800 + zfs-linux (2.3.2-1) unstable; urgency=medium * New upstream version 2.3.2 (closes: #1104418). diff -Nru zfs-linux-2.3.2/debian/patches/series zfs-linux-2.3.2/debian/patches/series --- zfs-linux-2.3.2/debian/patches/series 2025-05-02 17:45:56.000000000 +0800 +++ zfs-linux-2.3.2/debian/patches/series 2025-06-29 21:53:50.000000000 +0800 @@ -21,3 +21,9 @@ fix-pyzfs-version.patch BUILD_EXCLUSIVE_KERNEL_MIN.patch #bump-Linux-Minimum.patch +upstream/0001-Fix-2-bugs-in-non-raw-send-with-encryption.patch +upstream/0002-ARC-Avoid-overflows-in-arc_evict_adj.patch +upstream/0003-Sort-the-blocking-snapshots-list.patch +upstream/0004-Prefer-embedded-blocks-to-dedup.patch +upstream/0005-Add-more-descriptive-destroy-error-message.patch +upstream/0006-Export-correct-symbols-for-Lustre-Direct-IO.patch diff -Nru zfs-linux-2.3.2/debian/patches/upstream/0001-Fix-2-bugs-in-non-raw-send-with-encryption.patch zfs-linux-2.3.2/debian/patches/upstream/0001-Fix-2-bugs-in-non-raw-send-with-encryption.patch --- zfs-linux-2.3.2/debian/patches/upstream/0001-Fix-2-bugs-in-non-raw-send-with-encryption.patch 1970-01-01 08:00:00.000000000 +0800 +++ zfs-linux-2.3.2/debian/patches/upstream/0001-Fix-2-bugs-in-non-raw-send-with-encryption.patch 2025-06-29 21:47:39.000000000 +0800 @@ -0,0 +1,72 @@ +From f28c685a84e6e51865354656fb639c92c0fdafd9 Mon Sep 17 00:00:00 2001 +From: George Amanakis +Date: Mon, 19 May 2025 18:55:00 +0200 +Subject: [PATCH] Fix 2 bugs in non-raw send with encryption + +Bisecting identified the redacted send/receive as the source of the bug +for issue #12014. Specifically the call to +dsl_dataset_hold_obj(&fromds) has been replaced by +dsl_dataset_hold_obj_flags() which passes a DECRYPT flag and creates +a key mapping. A subsequent dsl_dataset_rele_flag(&fromds) is missing +and the key mapping is not cleared. This may be inadvertedly used, which +results in arc_untransform failing with ECKSUM in: + arc_untransform+0x96/0xb0 [zfs] + dbuf_read_verify_dnode_crypt+0x196/0x350 [zfs] + dbuf_read+0x56/0x770 [zfs] + dmu_buf_hold_by_dnode+0x4a/0x80 [zfs] + zap_lockdir+0x87/0xf0 [zfs] + zap_lookup_norm+0x5c/0xd0 [zfs] + zap_lookup+0x16/0x20 [zfs] + zfs_get_zplprop+0x8d/0x1d0 [zfs] + setup_featureflags+0x267/0x2e0 [zfs] + dmu_send_impl+0xe7/0xcb0 [zfs] + dmu_send_obj+0x265/0x360 [zfs] + zfs_ioc_send+0x10c/0x280 [zfs] + +Fix this by restoring the call to dsl_dataset_hold_obj(). + +The same applies for to_ds: here replace dsl_dataset_rele(&to_ds) with +dsl_dataset_rele_flags(). + +Both leaked key mappings will cause a panic when exporting the +sending pool or unloading the zfs module after a non-raw send from +an encrypted filesystem. + +Contributions-by: Hank Barta +Contributions-by: Paul Dagnelie +Reviewed-by: Alexander Motin +Reviewed-by: Richard Yao +Reviewed-by: Rob Norris +Reviewed-by: Brian Behlendorf +Signed-off-by: George Amanakis +Closes #12014 +Closes #17340 +(cherry picked from commit ea74cdedda8b9575d7e94198d38f12943ac41343) +--- + module/zfs/dmu_send.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/module/zfs/dmu_send.c b/module/zfs/dmu_send.c +index e21af11d20d1..4f27f3df0e55 100644 +--- a/module/zfs/dmu_send.c ++++ b/module/zfs/dmu_send.c +@@ -2687,8 +2687,8 @@ dmu_send_obj(const char *pool, uint64_t tosnap, uint64_t fromsnap, + } + + if (fromsnap != 0) { +- err = dsl_dataset_hold_obj_flags(dspp.dp, fromsnap, dsflags, +- FTAG, &fromds); ++ err = dsl_dataset_hold_obj(dspp.dp, fromsnap, FTAG, &fromds); ++ + if (err != 0) { + dsl_dataset_rele_flags(dspp.to_ds, dsflags, FTAG); + dsl_pool_rele(dspp.dp, FTAG); +@@ -2740,7 +2740,7 @@ dmu_send_obj(const char *pool, uint64_t tosnap, uint64_t fromsnap, + kmem_free(dspp.fromredactsnaps, + dspp.numfromredactsnaps * sizeof (uint64_t)); + +- dsl_dataset_rele(dspp.to_ds, FTAG); ++ dsl_dataset_rele_flags(dspp.to_ds, dsflags, FTAG); + return (err); + } + diff -Nru zfs-linux-2.3.2/debian/patches/upstream/0002-ARC-Avoid-overflows-in-arc_evict_adj.patch zfs-linux-2.3.2/debian/patches/upstream/0002-ARC-Avoid-overflows-in-arc_evict_adj.patch --- zfs-linux-2.3.2/debian/patches/upstream/0002-ARC-Avoid-overflows-in-arc_evict_adj.patch 1970-01-01 08:00:00.000000000 +0800 +++ zfs-linux-2.3.2/debian/patches/upstream/0002-ARC-Avoid-overflows-in-arc_evict_adj.patch 2025-06-29 21:47:48.000000000 +0800 @@ -0,0 +1,64 @@ +From 9b446fbb605e8ab938b45cda6c07fe0bbc865fc4 Mon Sep 17 00:00:00 2001 +From: Alexander Motin +Date: Tue, 6 May 2025 12:31:38 -0400 +Subject: [PATCH] ARC: Avoid overflows in arc_evict_adj() (#17255) + +With certain combinations of target ARC states balance and ghost +hit rates it was possible to get the fractions outside of allowed +range. This patch limits maximum balance adjustment speed, which +should make it impossible, and also asserts it. + +Fixes #17210 +Signed-off-by: Alexander Motin +Sponsored by: iXsystems, Inc. +Reviewed-by: Rob Norris +Reviewed-by: Tony Hutter +(cherry picked from commit b1ccab17213b38aa269e85c6b371d69eb25b6ca9) +--- + module/zfs/arc.c | 15 ++++++++++----- + 1 file changed, 10 insertions(+), 5 deletions(-) + +diff --git a/module/zfs/arc.c b/module/zfs/arc.c +index 13590410acec..0e8b3b321bc7 100644 +--- a/module/zfs/arc.c ++++ b/module/zfs/arc.c +@@ -4200,15 +4200,17 @@ static uint64_t + arc_evict_adj(uint64_t frac, uint64_t total, uint64_t up, uint64_t down, + uint_t balance) + { +- if (total < 8 || up + down == 0) ++ if (total < 32 || up + down == 0) + return (frac); + + /* +- * We should not have more ghost hits than ghost size, but they +- * may get close. Restrict maximum adjustment in that case. ++ * We should not have more ghost hits than ghost size, but they may ++ * get close. To avoid overflows below up/down should not be bigger ++ * than 1/5 of total. But to limit maximum adjustment speed restrict ++ * it some more. + */ +- if (up + down >= total / 4) { +- uint64_t scale = (up + down) / (total / 8); ++ if (up + down >= total / 16) { ++ uint64_t scale = (up + down) / (total / 32); + up /= scale; + down /= scale; + } +@@ -4217,6 +4219,7 @@ arc_evict_adj(uint64_t frac, uint64_t total, uint64_t up, uint64_t down, + int s = highbit64(total); + s = MIN(64 - s, 32); + ++ ASSERT3U(frac, <=, 1ULL << 32); + uint64_t ofrac = (1ULL << 32) - frac; + + if (frac >= 4 * ofrac) +@@ -4227,6 +4230,8 @@ arc_evict_adj(uint64_t frac, uint64_t total, uint64_t up, uint64_t down, + down = (down << s) / (total >> (32 - s)); + down = down * 100 / balance; + ++ ASSERT3U(up, <=, (1ULL << 32) - frac); ++ ASSERT3U(down, <=, frac); + return (frac + up - down); + } + diff -Nru zfs-linux-2.3.2/debian/patches/upstream/0003-Sort-the-blocking-snapshots-list.patch zfs-linux-2.3.2/debian/patches/upstream/0003-Sort-the-blocking-snapshots-list.patch --- zfs-linux-2.3.2/debian/patches/upstream/0003-Sort-the-blocking-snapshots-list.patch 1970-01-01 08:00:00.000000000 +0800 +++ zfs-linux-2.3.2/debian/patches/upstream/0003-Sort-the-blocking-snapshots-list.patch 2025-06-29 21:47:53.000000000 +0800 @@ -0,0 +1,49 @@ +From ad63ab2d90c5072944b71b0ccd11531e8665c843 Mon Sep 17 00:00:00 2001 +From: Artem +Date: Fri, 2 May 2025 03:40:23 +0300 +Subject: [PATCH] Sort the blocking snapshots list #12751 (#17264) + +When multiple snapshots prevent the destruction/rollback of the +respective dataset/snapshot/volume via zfs destroy or zfs rollback, +the error message does not list the blocking snapshots sorted +according to their order of creation. This causes inconvenience and can +lead to confusion, and also creates a contrast with a returned message +from zfs list -t snap function. + +Closes: #12751 + +Signed-off-by: Artem-OSSRevival +Reviewed-by: Alexander Motin +Reviewed-by: Tony Hutter +(cherry picked from commit 27f3d94940490d891c70e0c148f80d0c0ce09ed4) +--- + cmd/zfs/zfs_main.c | 2 +- + lib/libzfs/libzfs_iter.c | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/cmd/zfs/zfs_main.c b/cmd/zfs/zfs_main.c +index 2349373402ad..c9ebae575aeb 100644 +--- a/cmd/zfs/zfs_main.c ++++ b/cmd/zfs/zfs_main.c +@@ -4440,7 +4440,7 @@ zfs_do_rollback(int argc, char **argv) + if (cb.cb_create > 0) + min_txg = cb.cb_create; + +- if ((ret = zfs_iter_snapshots_v2(zhp, 0, rollback_check, &cb, ++ if ((ret = zfs_iter_snapshots_sorted_v2(zhp, 0, rollback_check, &cb, + min_txg, 0)) != 0) + goto out; + if ((ret = zfs_iter_bookmarks_v2(zhp, 0, rollback_check, &cb)) != 0) +diff --git a/lib/libzfs/libzfs_iter.c b/lib/libzfs/libzfs_iter.c +index 1ce833c87ec6..1844ce1624b3 100644 +--- a/lib/libzfs/libzfs_iter.c ++++ b/lib/libzfs/libzfs_iter.c +@@ -570,7 +570,7 @@ iter_dependents_cb(zfs_handle_t *zhp, void *arg) + err = zfs_iter_filesystems_v2(zhp, ida->flags, + iter_dependents_cb, ida); + if (err == 0) +- err = zfs_iter_snapshots_v2(zhp, ida->flags, ++ err = zfs_iter_snapshots_sorted_v2(zhp, ida->flags, + iter_dependents_cb, ida, 0, 0); + ida->stack = isf.next; + } diff -Nru zfs-linux-2.3.2/debian/patches/upstream/0004-Prefer-embedded-blocks-to-dedup.patch zfs-linux-2.3.2/debian/patches/upstream/0004-Prefer-embedded-blocks-to-dedup.patch --- zfs-linux-2.3.2/debian/patches/upstream/0004-Prefer-embedded-blocks-to-dedup.patch 1970-01-01 08:00:00.000000000 +0800 +++ zfs-linux-2.3.2/debian/patches/upstream/0004-Prefer-embedded-blocks-to-dedup.patch 2025-06-29 21:47:58.000000000 +0800 @@ -0,0 +1,64 @@ +From 602fecc316ae00febe2ba1af7d2ef5b9e2a82437 Mon Sep 17 00:00:00 2001 +From: Alexander Motin +Date: Thu, 13 Mar 2025 13:27:15 -0400 +Subject: [PATCH] Prefer embedded blocks to dedup + +Since embedded blocks introduction 11 years ago, their writing was +blocked if dedup is enabled. After searching through the modern +code I see no reason for this restriction to exist. Same time +embedded blocks are dramatically cheaper. Even regular write of +so small blocks would likely be cheaper than deduplication, even +if the last is successful, not mentioning otherwise. + +Reviewed-by: Allan Jude +Reviewed-by: Tony Hutter +Signed-off-by: Alexander Motin +Sponsored by: iXsystems, Inc. +Closes #17113 +(cherry picked from commit 09f4dd06c3e3275e1aa0b8d12a894cf140d19c3f) +--- + module/zfs/zio.c | 3 +-- + .../cli_root/zpool_prefetch/zpool_prefetch_001_pos.ksh | 2 +- + tests/zfs-tests/tests/functional/dedup/dedup_quota.ksh | 2 +- + 3 files changed, 3 insertions(+), 4 deletions(-) + +diff --git a/module/zfs/zio.c b/module/zfs/zio.c +index f0328e84e1a6..132f6c677e58 100644 +--- a/module/zfs/zio.c ++++ b/module/zfs/zio.c +@@ -2006,8 +2006,7 @@ zio_write_compress(zio_t *zio) + compress = ZIO_COMPRESS_OFF; + if (cabd != NULL) + abd_free(cabd); +- } else if (!zp->zp_dedup && !zp->zp_encrypt && +- psize <= BPE_PAYLOAD_SIZE && ++ } else if (psize <= BPE_PAYLOAD_SIZE && !zp->zp_encrypt && + zp->zp_level == 0 && !DMU_OT_HAS_FILL(zp->zp_type) && + spa_feature_is_enabled(spa, SPA_FEATURE_EMBEDDED_DATA)) { + void *cbuf = abd_borrow_buf_copy(cabd, lsize); +diff --git a/tests/zfs-tests/tests/functional/cli_root/zpool_prefetch/zpool_prefetch_001_pos.ksh b/tests/zfs-tests/tests/functional/cli_root/zpool_prefetch/zpool_prefetch_001_pos.ksh +index 0f8b0dfd6c97..8ef3a66ad0d9 100755 +--- a/tests/zfs-tests/tests/functional/cli_root/zpool_prefetch/zpool_prefetch_001_pos.ksh ++++ b/tests/zfs-tests/tests/functional/cli_root/zpool_prefetch/zpool_prefetch_001_pos.ksh +@@ -76,7 +76,7 @@ log_must zpool prefetch -t ddt $TESTPOOL + # to generate a reasonable size DDT for testing purposes. + + DATASET=$TESTPOOL/ddt +-log_must zfs create -o dedup=on $DATASET ++log_must zfs create -o compression=off -o dedup=on $DATASET + MNTPOINT=$(get_prop mountpoint $TESTPOOL/ddt) + + log_note "Generating dataset ..." +diff --git a/tests/zfs-tests/tests/functional/dedup/dedup_quota.ksh b/tests/zfs-tests/tests/functional/dedup/dedup_quota.ksh +index 141286ba7c07..bcb8a89dbb4d 100755 +--- a/tests/zfs-tests/tests/functional/dedup/dedup_quota.ksh ++++ b/tests/zfs-tests/tests/functional/dedup/dedup_quota.ksh +@@ -80,7 +80,7 @@ function do_setup + log_must truncate -s 5G $VDEV_GENERAL + # Use 'xattr=sa' to prevent selinux xattrs influencing our accounting + log_must zpool create -o ashift=12 -f -O xattr=sa -m $MOUNTDIR $POOL $VDEV_GENERAL +- log_must zfs set dedup=on $POOL ++ log_must zfs set compression=off dedup=on $POOL + log_must set_tunable32 TXG_TIMEOUT 600 + } + diff -Nru zfs-linux-2.3.2/debian/patches/upstream/0005-Add-more-descriptive-destroy-error-message.patch zfs-linux-2.3.2/debian/patches/upstream/0005-Add-more-descriptive-destroy-error-message.patch --- zfs-linux-2.3.2/debian/patches/upstream/0005-Add-more-descriptive-destroy-error-message.patch 1970-01-01 08:00:00.000000000 +0800 +++ zfs-linux-2.3.2/debian/patches/upstream/0005-Add-more-descriptive-destroy-error-message.patch 2025-06-29 21:48:01.000000000 +0800 @@ -0,0 +1,51 @@ +From 0956fd736cd4ea054a446541a1596d1ac441ca0b Mon Sep 17 00:00:00 2001 +From: Artem-OSSRevival +Date: Thu, 24 Apr 2025 04:17:52 +0300 +Subject: [PATCH] Add more descriptive destroy error message +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Reviewed-by: Tony Hutter +Reviewed-by: Alexander Motin +Reviewed-by: Tino Reichardt +Reviewed by: Attila Fülöp +Signed-off-by: Artem-OSSRevival +Fixes: #14538 +Closes: #17234 +(cherry picked from commit 37a3e26552158cb30a0bac0719c8dca40e22f245) +--- + lib/libzfs/libzfs_dataset.c | 20 ++++++++++++++++++++ + 1 file changed, 20 insertions(+) + +diff --git a/lib/libzfs/libzfs_dataset.c b/lib/libzfs/libzfs_dataset.c +index 8d9639221c22..576493338613 100644 +--- a/lib/libzfs/libzfs_dataset.c ++++ b/lib/libzfs/libzfs_dataset.c +@@ -4022,6 +4022,26 @@ zfs_destroy_snaps_nvl(libzfs_handle_t *hdl, nvlist_t *snaps, boolean_t defer) + dgettext(TEXT_DOMAIN, "snapshot is cloned")); + ret = zfs_error(hdl, EZFS_EXISTS, errbuf); + break; ++ case EBUSY: { ++ nvlist_t *existing_holds; ++ int err = lzc_get_holds(nvpair_name(pair), ++ &existing_holds); ++ ++ /* check the presence of holders */ ++ if (err == 0 && !nvlist_empty(existing_holds)) { ++ zfs_error_aux(hdl, ++ dgettext(TEXT_DOMAIN, "it's being held. " ++ "Run 'zfs holds -r %s' to see holders."), ++ nvpair_name(pair)); ++ ret = zfs_error(hdl, EBUSY, errbuf); ++ } else { ++ ret = zfs_standard_error(hdl, errno, errbuf); ++ } ++ ++ if (err == 0) ++ nvlist_free(existing_holds); ++ break; ++ } + default: + ret = zfs_standard_error(hdl, errno, errbuf); + break; diff -Nru zfs-linux-2.3.2/debian/patches/upstream/0006-Export-correct-symbols-for-Lustre-Direct-IO.patch zfs-linux-2.3.2/debian/patches/upstream/0006-Export-correct-symbols-for-Lustre-Direct-IO.patch --- zfs-linux-2.3.2/debian/patches/upstream/0006-Export-correct-symbols-for-Lustre-Direct-IO.patch 1970-01-01 08:00:00.000000000 +0800 +++ zfs-linux-2.3.2/debian/patches/upstream/0006-Export-correct-symbols-for-Lustre-Direct-IO.patch 2025-06-29 21:48:04.000000000 +0800 @@ -0,0 +1,56 @@ +From a77d641f01b38726acba487219e553915403df87 Mon Sep 17 00:00:00 2001 +From: Brian Atkinson +Date: Thu, 24 Apr 2025 13:55:21 -0400 +Subject: [PATCH] Export correct symbols for Lustre Direct I/O + +Originally the Lustre ZFS OSD code was going to use zfs_uio_t structs +for supporting Direct I/O with ZFS. However, this has changed to using +abd_t structs instead. This exports the proper symbols that will be used +by the Lustre ZFS OSD code. + +Reviewed-by: Tony Hutter +Reviewed-by: Alexander Motin +Signed-off-by: Brian Atkinson +Closes #17256 +(cherry picked from commit 7031a48c7077822bf6e3c53b3e753155ee7fbc1c) +--- + module/os/linux/zfs/abd_os.c | 2 ++ + module/zfs/abd.c | 2 ++ + module/zfs/dmu_direct.c | 4 ++-- + 3 files changed, 6 insertions(+), 2 deletions(-) + +diff --git a/module/os/linux/zfs/abd_os.c b/module/os/linux/zfs/abd_os.c +index 8e4d271976ea..e1140b31a97a 100644 +--- a/module/os/linux/zfs/abd_os.c ++++ b/module/os/linux/zfs/abd_os.c +@@ -1340,6 +1340,8 @@ abd_bio_map_off(struct bio *bio, abd_t *abd, + return (io_size); + } + ++EXPORT_SYMBOL(abd_alloc_from_pages); ++ + /* Tunable Parameters */ + module_param(zfs_abd_scatter_enabled, int, 0644); + MODULE_PARM_DESC(zfs_abd_scatter_enabled, +diff --git a/module/zfs/abd.c b/module/zfs/abd.c +index c2784b9af035..826928e67350 100644 +--- a/module/zfs/abd.c ++++ b/module/zfs/abd.c +@@ -1210,3 +1210,5 @@ abd_raidz_rec_iterate(abd_t **cabds, abd_t **tabds, + } + abd_exit_critical(flags); + } ++ ++EXPORT_SYMBOL(abd_free); +diff --git a/module/zfs/dmu_direct.c b/module/zfs/dmu_direct.c +index 319aaf30be5a..2d5253a5d060 100644 +--- a/module/zfs/dmu_direct.c ++++ b/module/zfs/dmu_direct.c +@@ -393,5 +393,5 @@ dmu_write_uio_direct(dnode_t *dn, zfs_uio_t *uio, uint64_t size, dmu_tx_t *tx) + } + #endif /* _KERNEL */ + +-EXPORT_SYMBOL(dmu_read_uio_direct); +-EXPORT_SYMBOL(dmu_write_uio_direct); ++EXPORT_SYMBOL(dmu_read_abd); ++EXPORT_SYMBOL(dmu_write_abd);