From: Josef Bacik Date: Tue, 21 Jul 2020 14:22:32 +0000 (-0400) Subject: btrfs: flush delayed refs when trying to reserve data space X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=cb3e3930459972dbafc274bcde3fdc1462429391;p=linux.git btrfs: flush delayed refs when trying to reserve data space We can end up with freed extents in the delayed refs, and thus may_commit_transaction() may not think we have enough pinned space to commit the transaction and we'll ENOSPC early. Handle this by running the delayed refs in order to make sure pinned is uptodate before we try to commit the transaction. Tested-by: Nikolay Borisov Reviewed-by: Johannes Thumshirn Signed-off-by: Josef Bacik Signed-off-by: David Sterba --- diff --git a/fs/btrfs/space-info.c b/fs/btrfs/space-info.c index 6d82c444ceff1..8496518297f3e 100644 --- a/fs/btrfs/space-info.c +++ b/fs/btrfs/space-info.c @@ -1023,6 +1023,7 @@ static const enum btrfs_flush_state evict_flush_states[] = { static const enum btrfs_flush_state data_flush_states[] = { FLUSH_DELALLOC_WAIT, RUN_DELAYED_IPUTS, + FLUSH_DELAYED_REFS, COMMIT_TRANS, };