mirror of
https://github.com/versity/scoutfs.git
synced 2026-01-11 06:00:19 +00:00
Server code that wants to dirty blocks by holding a commit won't be allowed to until the current allocators for the server transaction have enough space for the holder. As an active holder applies the commit the allocators are refilled and the waiting holders will proceed. But the current allocators can have no resources as the server starts up. There will never be active holders to apply the commit and refill the allocators. In this case all the holders will block indefinitely. The fix is to trigger a server commit when a holder doesn't have room. It used to be that commits were only triggered when apply callers were waiting. We transfer some of that logic into a new 'committing' field so that we can have commits in flight without apply callers waiting. We add it to the server commit tracing. While we're at it we clean up the logic that tests if a hold can proceed. It used to be confusingly split across two functions that both could sample the current allocator space remaining. This could lead to weird cases where the first holder could use the second alloc remaining call, not the one whose values were tested to see if the holder could fit. Now each hold check only samples the allocators once. And finally we fix a subtle case where the budget exceeded message can spuriously trigger in the case where dirtying the freed list created a new empty block after the holder recorded the amount of space in the freed block. Signed-off-by: Zach Brown <zab@versity.com>