Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 360494
b: refs/heads/master
c: c58aaad
h: refs/heads/master
v: v3
  • Loading branch information
Miao Xie authored and Josef Bacik committed Feb 28, 2013
1 parent 4b525f0 commit b821a6d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: d5c1207017cd8387b4d3224dd7ab6cf5cd7f1c9a
refs/heads/master: c58aaad2ac46f8dbce9ab7f7a7a3726e332a56ee
21 changes: 19 additions & 2 deletions trunk/fs/btrfs/ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -2064,6 +2064,8 @@ static noinline int btrfs_ioctl_snap_destroy(struct file *file,
struct btrfs_root *dest = NULL;
struct btrfs_ioctl_vol_args *vol_args;
struct btrfs_trans_handle *trans;
struct btrfs_block_rsv block_rsv;
u64 qgroup_reserved;
int namelen;
int ret;
int err = 0;
Expand Down Expand Up @@ -2153,12 +2155,23 @@ static noinline int btrfs_ioctl_snap_destroy(struct file *file,
if (err)
goto out_up_write;

btrfs_init_block_rsv(&block_rsv, BTRFS_BLOCK_RSV_TEMP);
/*
* One for dir inode, two for dir entries, two for root
* ref/backref.
*/
err = btrfs_subvolume_reserve_metadata(root, &block_rsv,
5, &qgroup_reserved);
if (err)
goto out_up_write;

trans = btrfs_start_transaction(root, 0);
if (IS_ERR(trans)) {
err = PTR_ERR(trans);
goto out_up_write;
goto out_release;
}
trans->block_rsv = &root->fs_info->global_block_rsv;
trans->block_rsv = &block_rsv;
trans->bytes_reserved = block_rsv.size;

ret = btrfs_unlink_subvol(trans, root, dir,
dest->root_key.objectid,
Expand Down Expand Up @@ -2188,10 +2201,14 @@ static noinline int btrfs_ioctl_snap_destroy(struct file *file,
}
}
out_end_trans:
trans->block_rsv = NULL;
trans->bytes_reserved = 0;
ret = btrfs_end_transaction(trans, root);
if (ret && !err)
err = ret;
inode->i_flags |= S_DEAD;
out_release:
btrfs_subvolume_release_metadata(root, &block_rsv, qgroup_reserved);
out_up_write:
up_write(&root->fs_info->subvol_sem);
out_unlock:
Expand Down

0 comments on commit b821a6d

Please sign in to comment.