summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorLiu Bo <liubo2009@cn.fujitsu.com>2012-02-16 18:34:39 +0800
committerDavid Sterba <dsterba@suse.cz>2012-02-16 17:23:18 +0100
commitd9b0218f6cb682aa6a4ada2bfc5a25fdf3018563 (patch)
treeea325470025698b1f9bfd8ff034d0d54ee89bb59 /fs
parent9d47c7671dc555e198c7347a173ed37316e0c4c1 (diff)
downloadop-kernel-dev-d9b0218f6cb682aa6a4ada2bfc5a25fdf3018563.zip
op-kernel-dev-d9b0218f6cb682aa6a4ada2bfc5a25fdf3018563.tar.gz
Btrfs: fix a bug on overcommit stuff
When overcommitting, we should check the sum of pinned space and bytes for delayed item. Signed-off-by: Liu Bo <liubo2009@cn.fujitsu.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/btrfs/extent-tree.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index 60bfe2d..dc083f5 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -3611,12 +3611,15 @@ static int may_commit_transaction(struct btrfs_root *root,
if (space_info != delayed_rsv->space_info)
return -ENOSPC;
+ spin_lock(&space_info->lock);
spin_lock(&delayed_rsv->lock);
- if (delayed_rsv->size < bytes) {
+ if (space_info->bytes_pinned + delayed_rsv->size < bytes) {
spin_unlock(&delayed_rsv->lock);
+ spin_unlock(&space_info->lock);
return -ENOSPC;
}
spin_unlock(&delayed_rsv->lock);
+ spin_unlock(&space_info->lock);
commit:
trans = btrfs_join_transaction(root);
OpenPOWER on IntegriCloud