Skip to content

Commit

Permalink
Btrfs: fix missing reserved space release in error path of delalloc r…
Browse files Browse the repository at this point in the history
…eservation

We forget to release the reserved space in the error path of delalloc
reservatiom, fix it.

Signed-off-by: Miao Xie <[email protected]>
Signed-off-by: Chris Mason <[email protected]>
  • Loading branch information
Miao Xie authored and Chris Mason committed Dec 17, 2012
1 parent 543eabd commit 4b5829a
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions fs/btrfs/extent-tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -4559,6 +4559,9 @@ int btrfs_delalloc_reserve_metadata(struct inode *inode, u64 num_bytes)
ret = btrfs_qgroup_reserve(root, num_bytes +
nr_extents * root->leafsize);
if (ret) {
spin_lock(&BTRFS_I(inode)->lock);
calc_csum_metadata_size(inode, num_bytes, 0);
spin_unlock(&BTRFS_I(inode)->lock);
mutex_unlock(&BTRFS_I(inode)->delalloc_mutex);
return ret;
}
Expand Down Expand Up @@ -4594,6 +4597,10 @@ int btrfs_delalloc_reserve_metadata(struct inode *inode, u64 num_bytes)
btrfs_ino(inode),
to_free, 0);
}
if (root->fs_info->quota_enabled) {
btrfs_qgroup_free(root, num_bytes +
nr_extents * root->leafsize);
}
mutex_unlock(&BTRFS_I(inode)->delalloc_mutex);
return ret;
}
Expand Down

0 comments on commit 4b5829a

Please sign in to comment.