mirror_zfs/module
Paul Dagnelie ab653603f8 Don't assert mg_initialized due to device addition race
During device removal stress tests, we noticed that we were tripping 
the assertion that mg_initialized was true. After investigation, it was 
determined that the mg in question was the embedded log metaslab 
group for a newly added vdev; the normal mg had been initialized (by 
metaslab_sync_reassess, via vdev_sync_done). However, because the spa 
config alloc lock is not held as writer across both calls to 
metaslab_sync_reassess, it is possible for an allocation to happen 
between the two metaslab_groups being initialized. Because the metaslab 
code doesn't check the group in question, just the vdev's main mg, it 
is possible to get past the initial check in vdev_allocatable and 
later fail due to the assertion.

We simply remove the assertions. We could also consider locking the 
ALLOC lock around the reassess calls in vdev_sync_done, but that risks 
deadlocks. We could check the actual target mg in vdev_allocatable, 
but that risks racing with a passivation that comes in after that 
check but before the assertion. We still won't be able to actually 
allocate from the metaslab group if no metaslabs are ready, so this 
change shouldn't break anything.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: George Wilson <george.wilson@delphix.com>
Signed-off-by: Paul Dagnelie <pcd@delphix.com>
Closes #15818
2024-01-29 14:53:29 -08:00
..
avl Suppress Clang Static Analyzer false positive in the AVL tree code. 2023-03-08 13:51:21 -08:00
icp Add BTI landing pads to the AArch64 SHA2 assembly 2023-10-04 12:36:21 -07:00
lua Add loongarch64 support 2023-04-25 16:05:45 -07:00
nvpair nvpair: Constify string functions 2023-03-14 15:25:50 -07:00
os linux spl: fix typo in top comment of spl-condvar.c 2024-01-29 14:53:29 -08:00
unicode Illumos #15286: do_composition() needs sign awareness 2023-01-05 11:16:21 -08:00
zcommon set autotrim default to 'off' everywhere 2023-07-21 16:35:12 -07:00
zfs Don't assert mg_initialized due to device addition race 2024-01-29 14:53:29 -08:00
zstd Resolve WS-2021-0184 vulnerability in zstd 2023-02-02 15:12:51 -08:00
.gitignore FreeBSD: Ignore symlink to i386 includes 2022-08-02 16:34:23 -07:00
Kbuild.in linux 6.7 compat: rework shrinker setup for heap allocations 2023-12-21 11:03:08 -08:00
Makefile.bsd Finally drop long disabled vdev cache. 2023-06-09 12:40:55 -07:00
Makefile.in check-zstd-symbols: also ignore __pfx_ symbols 2023-09-19 08:52:06 -07:00