Commit 4b5829a8 authored by Miao Xie's avatar Miao Xie Committed by Chris Mason

Btrfs: fix missing reserved space release in error path of delalloc reservation

We forget to release the reserved space in the error path of delalloc
reservatiom, fix it.
Signed-off-by: default avatarMiao Xie <miaox@cn.fujitsu.com>
Signed-off-by: default avatarChris Mason <chris.mason@fusionio.com>
parent 543eabd5
...@@ -4559,6 +4559,9 @@ int btrfs_delalloc_reserve_metadata(struct inode *inode, u64 num_bytes) ...@@ -4559,6 +4559,9 @@ int btrfs_delalloc_reserve_metadata(struct inode *inode, u64 num_bytes)
ret = btrfs_qgroup_reserve(root, num_bytes + ret = btrfs_qgroup_reserve(root, num_bytes +
nr_extents * root->leafsize); nr_extents * root->leafsize);
if (ret) { 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); mutex_unlock(&BTRFS_I(inode)->delalloc_mutex);
return ret; return ret;
} }
...@@ -4594,6 +4597,10 @@ int btrfs_delalloc_reserve_metadata(struct inode *inode, u64 num_bytes) ...@@ -4594,6 +4597,10 @@ int btrfs_delalloc_reserve_metadata(struct inode *inode, u64 num_bytes)
btrfs_ino(inode), btrfs_ino(inode),
to_free, 0); 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); mutex_unlock(&BTRFS_I(inode)->delalloc_mutex);
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment