Skip to content

Commit 9e36c57

Browse files
pcd1193182behlendorf
authored andcommitted
Don't allocate from new metaslabs
Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Paul Dagnelie <[email protected]> Closes #15307 Closes #15308
1 parent d38f466 commit 9e36c57

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

module/zfs/metaslab.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3208,6 +3208,15 @@ metaslab_segment_weight(metaslab_t *msp)
32083208
static boolean_t
32093209
metaslab_should_allocate(metaslab_t *msp, uint64_t asize, boolean_t try_hard)
32103210
{
3211+
/*
3212+
* This case will usually but not always get caught by the checks below;
3213+
* metaslabs can be loaded by various means, including the trim and
3214+
* initialize code. Once that happens, without this check they are
3215+
* allocatable even before they finish their first txg sync.
3216+
*/
3217+
if (unlikely(msp->ms_new))
3218+
return (B_FALSE);
3219+
32113220
/*
32123221
* If the metaslab is loaded, ms_max_size is definitive and we can use
32133222
* the fast check. If it's not, the ms_max_size is a lower bound (once

0 commit comments

Comments
 (0)