Skip to content

Commit

Permalink
btrfs: run delayed iputs when flushing delalloc
Browse files Browse the repository at this point in the history
We have transient failures with btrfs/301, specifically in the part
where we do

for i in $(seq 0 10); do
	write 50m to file
	rm -f file
done

Sometimes this will result in a transient quota error, and it's because
sometimes we start writeback on the file which results in a delayed
iput, and thus the rm doesn't actually clean the file up.  When we're
flushing the quota space we need to run the delayed iputs to make sure
all the unlinks that we think have completed have actually completed.
This removes the small window where we could fail to find enough space
in our quota.

Signed-off-by: Josef Bacik <[email protected]>
  • Loading branch information
josefbacik committed Aug 21, 2024
1 parent a07bfa6 commit 2cf02bc
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions fs/btrfs/qgroup.c
Original file line number Diff line number Diff line change
Expand Up @@ -4185,6 +4185,8 @@ static int try_flush_qgroup(struct btrfs_root *root)
return 0;
}

btrfs_run_delayed_iputs(fs_info);
btrfs_wait_on_delayed_iputs(fs_info);
ret = btrfs_start_delalloc_snapshot(root, true);
if (ret < 0)
goto out;
Expand Down

0 comments on commit 2cf02bc

Please sign in to comment.