On 13.03.20 г. 21:58 ч., Josef Bacik wrote: > For unlink transactions and block group removal > btrfs_start_transaction_fallback_global_rsv will first try to start > an ordinary transaction and if it fails it will fall back to reserving > the required amount by stealing from the global reserve. This is > problematic because of all the same reasons we had with previous > iterations of the ENOSPC handling, thundering herd. We get a bunch of > failures all at once, everybody tries to allocate from the global > reserve, some win and some lose, we get an ENSOPC. > > Fix this behavior by introducing BTRFS_RESERVE_FLUSH_ALL_STEAL. It's > used to mark unlink reservation. To fix this we need to integrate this > logic into the normal ENOSPC infrastructure. We still go through all of > the normal flushing work, and at the moment we begin to fail all the > tickets we try to satisfy any tickets that are allowed to steal by > stealing from the global reserve. If this works we start the flushing > system over again just like we would with a normal ticket satisfaction. > This serializes our global reserve stealing, so we don't have the > thundering herd problem. > > Signed-off-by: Josef Bacik <josef@xxxxxxxxxxxxxx> Reviewed-by: Nikolay Borisov <nborisov@xxxxxxxx>
