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:
George Amanakis
2022-06-27 23:17:25 +02:00
committed by GitHub
parent 1cd72b9c13
commit 80a650b7bb
6 changed files with 66 additions and 20 deletions
+10
View File
@@ -1695,6 +1695,16 @@ dmu_objset_sync(objset_t *os, zio_t *pio, dmu_tx_t *tx)
&zp, dmu_objset_write_ready, NULL, NULL, dmu_objset_write_done,
os, ZIO_PRIORITY_ASYNC_WRITE, ZIO_FLAG_MUSTSUCCEED, &zb);
/*
* In the codepath dsl_dataset_sync()->dmu_objset_sync() we cannot
* rely on the zio above completing and calling back
* dmu_objset_write_done()->dsl_dataset_block_born() before
* dsl_dataset_sync() actually activates feature flags near its end.
* Decide here if any features need to be activated, before
* dsl_dataset_sync() completes its run.
*/
dsl_dataset_feature_set_activation(blkptr_copy, os->os_dsl_dataset);
/*
* Sync special dnodes - the parent IO for the sync is the root block
*/