mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2025-01-13 11:40:25 +03:00
Fix race in vdev_initialize_thread
Before allowing new allocations to the metaslab we need to ensure that any issued initializing writes have been synced. Otherwise, it's possible for metaslab_block_alloc() to allocate a range which is about to be overwritten by an initializing IO. Serapheim Dimitropoulos <serapheim@delphix.com> Reviewed-by: Richard Elling <Richard.Elling@RichardElling.com> Reviewed-by: Tim Chase <tim@chase2k.com> Reviewed-by: George Wilson <george.wilson@delphix.com> Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> Closes #8461
This commit is contained in:
parent
762f9ef3d9
commit
96ebc5a1a4
@ -628,6 +628,13 @@ vdev_initialize_thread(void *arg)
|
||||
|
||||
spa_config_exit(spa, SCL_CONFIG, FTAG);
|
||||
error = vdev_initialize_ranges(vd, deadbeef);
|
||||
|
||||
/*
|
||||
* Wait for the outstanding IO to be synced to prevent
|
||||
* newly allocated blocks from being overwritten.
|
||||
*/
|
||||
txg_wait_synced(spa_get_dsl(spa), 0);
|
||||
|
||||
vdev_initialize_ms_unmark(msp);
|
||||
spa_config_enter(spa, SCL_CONFIG, FTAG, RW_READER);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user