From 53da1a9fc2c8854a519356c0c8162564bf6b14a7 Mon Sep 17 00:00:00 2001 From: George Amanakis Date: Tue, 20 Dec 2022 21:39:39 +0100 Subject: [PATCH] Activate filesystem features only in syncing context Signed-off-by: George Amanakis --- module/zfs/dmu_objset.c | 7 ------ module/zfs/dsl_dataset.c | 22 +++++++++++-------- .../rsend/send_raw_large_blocks.ksh | 2 +- 3 files changed, 14 insertions(+), 17 deletions(-) diff --git a/module/zfs/dmu_objset.c b/module/zfs/dmu_objset.c index c17c829a04d8..0e8427f19937 100644 --- a/module/zfs/dmu_objset.c +++ b/module/zfs/dmu_objset.c @@ -2408,13 +2408,6 @@ dmu_objset_id_quota_upgrade_cb(objset_t *os) dmu_objset_userobjspace_present(os)) return (SET_ERROR(ENOTSUP)); - if (dmu_objset_userobjused_enabled(os)) - dmu_objset_ds(os)->ds_feature_activation[ - SPA_FEATURE_USEROBJ_ACCOUNTING] = (void *)B_TRUE; - if (dmu_objset_projectquota_enabled(os)) - dmu_objset_ds(os)->ds_feature_activation[ - SPA_FEATURE_PROJECT_QUOTA] = (void *)B_TRUE; - err = dmu_objset_space_upgrade(os); if (err) return (err); diff --git a/module/zfs/dsl_dataset.c b/module/zfs/dsl_dataset.c index dcb9ad6cccc9..57a58f88cec5 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]; + } } } diff --git a/tests/zfs-tests/tests/functional/rsend/send_raw_large_blocks.ksh b/tests/zfs-tests/tests/functional/rsend/send_raw_large_blocks.ksh index 39e93a7df3c2..48a76fca63e1 100755 --- a/tests/zfs-tests/tests/functional/rsend/send_raw_large_blocks.ksh +++ b/tests/zfs-tests/tests/functional/rsend/send_raw_large_blocks.ksh @@ -49,7 +49,7 @@ raw_backup=$TEST_BASE_DIR/raw_backup function cleanup { log_must rm -f $backup $raw_backup $ibackup $unc_backup - destroy_pool pool_lb/fs + destroy_pool pool_lb log_must rm -f $TESTDIR/vdev_a }