diff options
author | Liu Bo <bo.li.liu@oracle.com> | 2012-08-21 23:13:25 -0400 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2012-08-28 16:53:42 -0400 |
commit | d280e5be940931c84bb2e9831ead9d02bc785484 (patch) | |
tree | c35062de4aff85ec5de5ad1e8d48d62c66fc8fcb /fs/btrfs | |
parent | 24c03fa5cf3d02c327cf9f2fc39f72664b1bd7e1 (diff) |
Btrfs: fix ordered extent leak when failing to start a transaction
We cannot just return error before freeing ordered extent and releasing reserved
space when we fail to start a transacion.
Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs')
-rw-r--r-- | fs/btrfs/inode.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 38cda78de5e4..6ba80b902877 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
@@ -1882,8 +1882,11 @@ static int btrfs_finish_ordered_io(struct btrfs_ordered_extent *ordered_extent) | |||
1882 | trans = btrfs_join_transaction_nolock(root); | 1882 | trans = btrfs_join_transaction_nolock(root); |
1883 | else | 1883 | else |
1884 | trans = btrfs_join_transaction(root); | 1884 | trans = btrfs_join_transaction(root); |
1885 | if (IS_ERR(trans)) | 1885 | if (IS_ERR(trans)) { |
1886 | return PTR_ERR(trans); | 1886 | ret = PTR_ERR(trans); |
1887 | trans = NULL; | ||
1888 | goto out; | ||
1889 | } | ||
1887 | trans->block_rsv = &root->fs_info->delalloc_block_rsv; | 1890 | trans->block_rsv = &root->fs_info->delalloc_block_rsv; |
1888 | ret = btrfs_update_inode_fallback(trans, root, inode); | 1891 | ret = btrfs_update_inode_fallback(trans, root, inode); |
1889 | if (ret) /* -ENOMEM or corruption */ | 1892 | if (ret) /* -ENOMEM or corruption */ |