aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/btrfs/inode.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 1f013c5c36aa..b6b70bdd0992 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -2790,7 +2790,8 @@ static struct btrfs_trans_handle *__unlink_start_trans(struct inode *dir,
2790 return ERR_PTR(-ENOMEM); 2790 return ERR_PTR(-ENOMEM);
2791 } 2791 }
2792 2792
2793 trans = btrfs_start_transaction(root, 0); 2793 /* 1 for the orphan item */
2794 trans = btrfs_start_transaction(root, 1);
2794 if (IS_ERR(trans)) { 2795 if (IS_ERR(trans)) {
2795 btrfs_free_path(path); 2796 btrfs_free_path(path);
2796 root->fs_info->enospc_unlink = 0; 2797 root->fs_info->enospc_unlink = 0;
@@ -2895,6 +2896,12 @@ static struct btrfs_trans_handle *__unlink_start_trans(struct inode *dir,
2895 err = 0; 2896 err = 0;
2896out: 2897out:
2897 btrfs_free_path(path); 2898 btrfs_free_path(path);
2899 /* Migrate the orphan reservation over */
2900 if (!err)
2901 err = btrfs_block_rsv_migrate(trans->block_rsv,
2902 &root->fs_info->global_block_rsv,
2903 btrfs_calc_trans_metadata_size(root, 1));
2904
2898 if (err) { 2905 if (err) {
2899 btrfs_end_transaction(trans, root); 2906 btrfs_end_transaction(trans, root);
2900 root->fs_info->enospc_unlink = 0; 2907 root->fs_info->enospc_unlink = 0;