You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Looking at the code, this assertion in the code, this is the assertion that the alloctree is empty if ms_new is set. That variable is set in metaslab_init and unset the first time a sync is finished. However, it is not considered anywhere in the allocation path. Instead, we appear to rely on the fact that the metaslab will not be loaded or have a weight or ms_max_size set, which makes it always return false when considered in metaslab_should_allocate. However, metaslabs can be loaded by a variety of factors, including trim, initialize, and preloading. There are no actual mechanisms preventing this from happening to brand-new metaslabs, and once loaded, nothing in the allocation path prevents them from being used for allocations.
Analysis of the core file indicates that the metaslab was indeed selected for allocation for this txg; it is loaded, ms_primary is set, and ms_allocator is set to 2.
If my theory is correct, a simple fix is to add a check to metaslab_should_allocate that does not allow new metaslabs to be used. We may need to add similar lines in other places, to prevent new metaslabs from being trimmed or intiialized.
The text was updated successfully, but these errors were encountered:
As the topic says, there is a crash in ztest that indicates some sort of issue is going on in the metaslab accounting. This is the stack trace:
Looking at the code, this assertion in the code, this is the assertion that the alloctree is empty if
ms_new
is set. That variable is set inmetaslab_init
and unset the first time a sync is finished. However, it is not considered anywhere in the allocation path. Instead, we appear to rely on the fact that the metaslab will not be loaded or have a weight or ms_max_size set, which makes it always return false when considered inmetaslab_should_allocate
. However, metaslabs can be loaded by a variety of factors, including trim, initialize, and preloading. There are no actual mechanisms preventing this from happening to brand-new metaslabs, and once loaded, nothing in the allocation path prevents them from being used for allocations.Analysis of the core file indicates that the metaslab was indeed selected for allocation for this txg; it is loaded, ms_primary is set, and ms_allocator is set to 2.
If my theory is correct, a simple fix is to add a check to
metaslab_should_allocate
that does not allow new metaslabs to be used. We may need to add similar lines in other places, to prevent new metaslabs from being trimmed or intiialized.The text was updated successfully, but these errors were encountered: