aboutsummaryrefslogtreecommitdiffstats
path: root/module/zfs/dsl_dataset.c
diff options
context:
space:
mode:
authorGeorge Amanakis <[email protected]>2023-01-12 03:00:39 +0100
committerGitHub <[email protected]>2023-01-11 18:00:39 -0800
commiteee9362a72cfd615e40928e86d61747683dc9dc6 (patch)
tree2565bfdc12e3ff3e8dd93f57e40fb56baadc9509 /module/zfs/dsl_dataset.c
parent6320b9e68e03cdf390b444693e06aaa51a49f0ca (diff)
Activate filesystem features only in syncing context
When activating filesystem features after receiving a snapshot, do so only in syncing context. Reviewed-by: Ryan Moeller <[email protected]> Reviewed-by: Richard Yao <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: George Amanakis <[email protected]> Closes #14304 Closes #14252
Diffstat (limited to 'module/zfs/dsl_dataset.c')
-rw-r--r--module/zfs/dsl_dataset.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/module/zfs/dsl_dataset.c b/module/zfs/dsl_dataset.c
index dcb9ad6cc..57a58f88c 100644
--- a/module/zfs/dsl_dataset.c
+++ b/module/zfs/dsl_dataset.c
@@ -1761,16 +1761,20 @@ dsl_dataset_snapshot_sync_impl(dsl_dataset_t *ds, const char *snapname,
/*
* We are not allowed to dirty a filesystem when done receiving
- * a snapshot. In this case the flag SPA_FEATURE_LARGE_BLOCKS will
- * not be set and a subsequent encrypted raw send will fail. Hence
- * activate this feature if needed here.
+ * a snapshot. In this case some flags such as SPA_FEATURE_LARGE_BLOCKS
+ * will not be set and a subsequent encrypted raw send will fail. Hence
+ * activate this feature if needed here. This needs to happen only in
+ * syncing context.
*/
- for (spa_feature_t f = 0; f < SPA_FEATURES; f++) {
- if (zfeature_active(f, ds->ds_feature_activation[f]) &&
- !(zfeature_active(f, ds->ds_feature[f]))) {
- dsl_dataset_activate_feature(dsobj, f,
- ds->ds_feature_activation[f], tx);
- ds->ds_feature[f] = ds->ds_feature_activation[f];
+ if (dmu_tx_is_syncing(tx)) {
+ for (spa_feature_t f = 0; f < SPA_FEATURES; f++) {
+ if (zfeature_active(f, ds->ds_feature_activation[f]) &&
+ !(zfeature_active(f, ds->ds_feature[f]))) {
+ dsl_dataset_activate_feature(dsobj, f,
+ ds->ds_feature_activation[f], tx);
+ ds->ds_feature[f] =
+ ds->ds_feature_activation[f];
+ }
}
}