diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c index a213bafe68ec56caf61048462f597774a867b919..277fe812d047d30adc67d023d3da6a96e5684e84 100644 --- a/fs/btrfs/transaction.c +++ b/fs/btrfs/transaction.c @@ -1600,15 +1600,19 @@ static int btrfs_flush_all_pending_stuffs(struct btrfs_trans_handle *trans, int ret; ret = btrfs_run_delayed_items(trans, root); - if (ret) - return ret; - /* * running the delayed items may have added new refs. account * them now so that they hinder processing of more delayed refs * as little as possible. */ - btrfs_delayed_refs_qgroup_accounting(trans, root->fs_info); + if (ret) { + btrfs_delayed_refs_qgroup_accounting(trans, root->fs_info); + return ret; + } + + ret = btrfs_delayed_refs_qgroup_accounting(trans, root->fs_info); + if (ret) + return ret; /* * rename don't use btrfs_join_transaction, so, once we