From: Josef Bacik <josef@xxxxxxxxxxxxxx> commit 2d3447261031503b181dacc549fe65ffe2d93d65 upstream. 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. CC: stable@xxxxxxxxxxxxxxx # 5.15+ Reviewed-by: Qu Wenruo <wqu@xxxxxxxx> Signed-off-by: Josef Bacik <josef@xxxxxxxxxxxxxx> Signed-off-by: David Sterba <dsterba@xxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- fs/btrfs/qgroup.c | 2 ++ 1 file changed, 2 insertions(+) --- a/fs/btrfs/qgroup.c +++ b/fs/btrfs/qgroup.c @@ -3677,6 +3677,8 @@ static int try_flush_qgroup(struct btrfs return 0; } + btrfs_run_delayed_iputs(root->fs_info); + btrfs_wait_on_delayed_iputs(root->fs_info); ret = btrfs_start_delalloc_snapshot(root, true); if (ret < 0) goto out; Patches currently in stable-queue which might be from josef@xxxxxxxxxxxxxx are queue-5.15/nfsd-remove-nfsd_stats-make-th_cnt-a-global-counter.patch queue-5.15/sunrpc-remove-pg_stats-from-svc_program.patch queue-5.15/nfsd-make-all-of-the-nfsd-stats-per-network-namespace.patch queue-5.15/nfsd-stop-setting-pg_stats-for-unused-stats.patch queue-5.15/btrfs-change-bug_on-to-assertion-when-checking-for-d.patch queue-5.15/sunrpc-don-t-change-sv_stats-if-it-doesn-t-exist.patch queue-5.15/btrfs-run-delayed-iputs-when-flushing-delalloc.patch queue-5.15/nfsd-make-svc_stat-per-network-namespace-instead-of-global.patch queue-5.15/nfsd-rename-nfsd_net_-to-nfsd_stats_.patch queue-5.15/sunrpc-use-the-struct-net-as-the-svc-proc-private.patch queue-5.15/sunrpc-pass-in-the-sv_stats-struct-through-svc_create_pooled.patch queue-5.15/nfsd-expose-proc-net-sunrpc-nfsd-in-net-namespaces.patch