mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 02:27:36 +03:00
Avoid panic with recordsize > 128k, raw sending and no large_blocks
The current codebase does not support raw sending buffers with block size > 128kB when large_blocks is not active. This can happen in the codepath dsl_dataset_sync()->dmu_objset_sync()->zio_nowait() which calls back dmu_objset_write_done()->dsl_dataset_block_born(). If dsl_dataset_sync() completes its run before dsl_dataset_block_born() is called, we will end up not activating some of the necessary flags, while having blocks based on those flags written in the filesystem. A subsequent send will then panic. Fix this by directly deciding in dmu_objset_sync() whether these flags need to be activated later by dsl_dataset_sync(). Instead of panicking due to a NULL pointer dereference in dmu_dump_write() in case of a send, print out an error message. Also during scrub verify there are no contradicting filesystem flags. Reviewed-by: Paul Dagnelie <pcd@delphix.com> Signed-off-by: George Amanakis <gamanakis@gmail.com> Closes #12275 Closes #12438
This commit is contained in:
+26
-20
@@ -130,6 +130,30 @@ parent_delta(dsl_dataset_t *ds, int64_t delta)
|
||||
return (new_bytes - old_bytes);
|
||||
}
|
||||
|
||||
void
|
||||
dsl_dataset_feature_set_activation(const blkptr_t *bp, dsl_dataset_t *ds)
|
||||
{
|
||||
spa_feature_t f;
|
||||
if (BP_GET_LSIZE(bp) > SPA_OLD_MAXBLOCKSIZE) {
|
||||
ds->ds_feature_activation[SPA_FEATURE_LARGE_BLOCKS] =
|
||||
(void *)B_TRUE;
|
||||
}
|
||||
|
||||
f = zio_checksum_to_feature(BP_GET_CHECKSUM(bp));
|
||||
if (f != SPA_FEATURE_NONE) {
|
||||
ASSERT3S(spa_feature_table[f].fi_type, ==,
|
||||
ZFEATURE_TYPE_BOOLEAN);
|
||||
ds->ds_feature_activation[f] = (void *)B_TRUE;
|
||||
}
|
||||
|
||||
f = zio_compress_to_feature(BP_GET_COMPRESS(bp));
|
||||
if (f != SPA_FEATURE_NONE) {
|
||||
ASSERT3S(spa_feature_table[f].fi_type, ==,
|
||||
ZFEATURE_TYPE_BOOLEAN);
|
||||
ds->ds_feature_activation[f] = (void *)B_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
dsl_dataset_block_born(dsl_dataset_t *ds, const blkptr_t *bp, dmu_tx_t *tx)
|
||||
{
|
||||
@@ -138,7 +162,6 @@ dsl_dataset_block_born(dsl_dataset_t *ds, const blkptr_t *bp, dmu_tx_t *tx)
|
||||
int compressed = BP_GET_PSIZE(bp);
|
||||
int uncompressed = BP_GET_UCSIZE(bp);
|
||||
int64_t delta;
|
||||
spa_feature_t f;
|
||||
|
||||
dprintf_bp(bp, "ds=%p", ds);
|
||||
|
||||
@@ -163,25 +186,7 @@ dsl_dataset_block_born(dsl_dataset_t *ds, const blkptr_t *bp, dmu_tx_t *tx)
|
||||
dsl_dataset_phys(ds)->ds_uncompressed_bytes += uncompressed;
|
||||
dsl_dataset_phys(ds)->ds_unique_bytes += used;
|
||||
|
||||
if (BP_GET_LSIZE(bp) > SPA_OLD_MAXBLOCKSIZE) {
|
||||
ds->ds_feature_activation[SPA_FEATURE_LARGE_BLOCKS] =
|
||||
(void *)B_TRUE;
|
||||
}
|
||||
|
||||
|
||||
f = zio_checksum_to_feature(BP_GET_CHECKSUM(bp));
|
||||
if (f != SPA_FEATURE_NONE) {
|
||||
ASSERT3S(spa_feature_table[f].fi_type, ==,
|
||||
ZFEATURE_TYPE_BOOLEAN);
|
||||
ds->ds_feature_activation[f] = (void *)B_TRUE;
|
||||
}
|
||||
|
||||
f = zio_compress_to_feature(BP_GET_COMPRESS(bp));
|
||||
if (f != SPA_FEATURE_NONE) {
|
||||
ASSERT3S(spa_feature_table[f].fi_type, ==,
|
||||
ZFEATURE_TYPE_BOOLEAN);
|
||||
ds->ds_feature_activation[f] = (void *)B_TRUE;
|
||||
}
|
||||
dsl_dataset_feature_set_activation(bp, ds);
|
||||
|
||||
/*
|
||||
* Track block for livelist, but ignore embedded blocks because
|
||||
@@ -5013,3 +5018,4 @@ EXPORT_SYMBOL(dsl_dsobj_to_dsname);
|
||||
EXPORT_SYMBOL(dsl_dataset_check_quota);
|
||||
EXPORT_SYMBOL(dsl_dataset_clone_swap_check_impl);
|
||||
EXPORT_SYMBOL(dsl_dataset_clone_swap_sync_impl);
|
||||
EXPORT_SYMBOL(dsl_dataset_feature_set_activation);
|
||||
|
||||
Reference in New Issue
Block a user