summaryrefslogtreecommitdiffstats
path: root/fs/btrfs
diff options
context:
space:
mode:
authorMiao Xie <miaox@cn.fujitsu.com>2012-12-05 10:53:25 +0000
committerChris Mason <chris.mason@fusionio.com>2012-12-16 20:46:18 -0500
commit4b5829a8e3104c8bc115d926a0285d3ff9bcfc77 (patch)
tree7d2c5060f86f850d4bfc9d6495ca7fe95b14f6da /fs/btrfs
parent543eabd5e1929bc73e22b279aa911eb01447535f (diff)
downloadop-kernel-dev-4b5829a8e3104c8bc115d926a0285d3ff9bcfc77.zip
op-kernel-dev-4b5829a8e3104c8bc115d926a0285d3ff9bcfc77.tar.gz
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: Miao Xie <miaox@cn.fujitsu.com> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
Diffstat (limited to 'fs/btrfs')
-rw-r--r--fs/btrfs/extent-tree.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index 98af837..e152809 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -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;
}
@@ -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;
}
OpenPOWER on IntegriCloud