mirror of
https://github.com/followmsi/android_kernel_google_msm.git
synced 2024-11-06 23:17:41 +00:00
Btrfs: fix misuse of trans block rsv
At the beginning of create_pending_snapshot, trans->block_rsv is set to pending->block_rsv and is used for snapshot things, however, when it is done, we do not recover it as will. Signed-off-by: Liu Bo <liubo2009@cn.fujitsu.com> Signed-off-by: Chris Mason <chris.mason@oracle.com>
This commit is contained in:
parent
65450aa645
commit
98c9942aca
1 changed files with 4 additions and 0 deletions
|
@ -884,6 +884,7 @@ static noinline int create_pending_snapshot(struct btrfs_trans_handle *trans,
|
||||||
struct btrfs_root *tree_root = fs_info->tree_root;
|
struct btrfs_root *tree_root = fs_info->tree_root;
|
||||||
struct btrfs_root *root = pending->root;
|
struct btrfs_root *root = pending->root;
|
||||||
struct btrfs_root *parent_root;
|
struct btrfs_root *parent_root;
|
||||||
|
struct btrfs_block_rsv *rsv;
|
||||||
struct inode *parent_inode;
|
struct inode *parent_inode;
|
||||||
struct dentry *parent;
|
struct dentry *parent;
|
||||||
struct dentry *dentry;
|
struct dentry *dentry;
|
||||||
|
@ -895,6 +896,8 @@ static noinline int create_pending_snapshot(struct btrfs_trans_handle *trans,
|
||||||
u64 objectid;
|
u64 objectid;
|
||||||
u64 root_flags;
|
u64 root_flags;
|
||||||
|
|
||||||
|
rsv = trans->block_rsv;
|
||||||
|
|
||||||
new_root_item = kmalloc(sizeof(*new_root_item), GFP_NOFS);
|
new_root_item = kmalloc(sizeof(*new_root_item), GFP_NOFS);
|
||||||
if (!new_root_item) {
|
if (!new_root_item) {
|
||||||
pending->error = -ENOMEM;
|
pending->error = -ENOMEM;
|
||||||
|
@ -1002,6 +1005,7 @@ static noinline int create_pending_snapshot(struct btrfs_trans_handle *trans,
|
||||||
btrfs_orphan_post_snapshot(trans, pending);
|
btrfs_orphan_post_snapshot(trans, pending);
|
||||||
fail:
|
fail:
|
||||||
kfree(new_root_item);
|
kfree(new_root_item);
|
||||||
|
trans->block_rsv = rsv;
|
||||||
btrfs_block_rsv_release(root, &pending->block_rsv, (u64)-1);
|
btrfs_block_rsv_release(root, &pending->block_rsv, (u64)-1);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue