aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/btrfs/ioctl.c10
-rw-r--r--fs/btrfs/transaction.c5
-rw-r--r--fs/btrfs/transaction.h1
3 files changed, 8 insertions, 8 deletions
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index 059546aa8fdf..8dcd4ff0c3a5 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -530,9 +530,10 @@ fail:
530 return ret; 530 return ret;
531} 531}
532 532
533static int create_snapshot(struct btrfs_root *root, struct dentry *dentry, 533static int create_snapshot(struct btrfs_root *root, struct inode *dir,
534 char *name, int namelen, u64 *async_transid, 534 struct dentry *dentry, char *name, int namelen,
535 bool readonly, struct btrfs_qgroup_inherit *inherit) 535 u64 *async_transid, bool readonly,
536 struct btrfs_qgroup_inherit *inherit)
536{ 537{
537 struct inode *inode; 538 struct inode *inode;
538 struct btrfs_pending_snapshot *pending_snapshot; 539 struct btrfs_pending_snapshot *pending_snapshot;
@@ -551,6 +552,7 @@ static int create_snapshot(struct btrfs_root *root, struct dentry *dentry,
551 pending_snapshot->dentry = dentry; 552 pending_snapshot->dentry = dentry;
552 pending_snapshot->root = root; 553 pending_snapshot->root = root;
553 pending_snapshot->readonly = readonly; 554 pending_snapshot->readonly = readonly;
555 pending_snapshot->dir = dir;
554 pending_snapshot->inherit = inherit; 556 pending_snapshot->inherit = inherit;
555 557
556 trans = btrfs_start_transaction(root->fs_info->extent_root, 6); 558 trans = btrfs_start_transaction(root->fs_info->extent_root, 6);
@@ -728,7 +730,7 @@ static noinline int btrfs_mksubvol(struct path *parent,
728 goto out_up_read; 730 goto out_up_read;
729 731
730 if (snap_src) { 732 if (snap_src) {
731 error = create_snapshot(snap_src, dentry, name, namelen, 733 error = create_snapshot(snap_src, dir, dentry, name, namelen,
732 async_transid, readonly, inherit); 734 async_transid, readonly, inherit);
733 } else { 735 } else {
734 error = create_subvol(BTRFS_I(dir)->root, dentry, 736 error = create_subvol(BTRFS_I(dir)->root, dentry,
diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c
index 3733c4939a27..71de435a291e 100644
--- a/fs/btrfs/transaction.c
+++ b/fs/btrfs/transaction.c
@@ -1068,7 +1068,6 @@ static noinline int create_pending_snapshot(struct btrfs_trans_handle *trans,
1068 struct inode *parent_inode; 1068 struct inode *parent_inode;
1069 struct btrfs_path *path; 1069 struct btrfs_path *path;
1070 struct btrfs_dir_item *dir_item; 1070 struct btrfs_dir_item *dir_item;
1071 struct dentry *parent;
1072 struct dentry *dentry; 1071 struct dentry *dentry;
1073 struct extent_buffer *tmp; 1072 struct extent_buffer *tmp;
1074 struct extent_buffer *old; 1073 struct extent_buffer *old;
@@ -1126,8 +1125,7 @@ static noinline int create_pending_snapshot(struct btrfs_trans_handle *trans,
1126 trans->bytes_reserved = trans->block_rsv->reserved; 1125 trans->bytes_reserved = trans->block_rsv->reserved;
1127 1126
1128 dentry = pending->dentry; 1127 dentry = pending->dentry;
1129 parent = dget_parent(dentry); 1128 parent_inode = pending->dir;
1130 parent_inode = parent->d_inode;
1131 parent_root = BTRFS_I(parent_inode)->root; 1129 parent_root = BTRFS_I(parent_inode)->root;
1132 record_root_in_trans(trans, parent_root); 1130 record_root_in_trans(trans, parent_root);
1133 1131
@@ -1275,7 +1273,6 @@ static noinline int create_pending_snapshot(struct btrfs_trans_handle *trans,
1275 if (ret) 1273 if (ret)
1276 btrfs_abort_transaction(trans, root, ret); 1274 btrfs_abort_transaction(trans, root, ret);
1277fail: 1275fail:
1278 dput(parent);
1279 trans->block_rsv = rsv; 1276 trans->block_rsv = rsv;
1280 trans->bytes_reserved = 0; 1277 trans->bytes_reserved = 0;
1281no_free_objectid: 1278no_free_objectid:
diff --git a/fs/btrfs/transaction.h b/fs/btrfs/transaction.h
index 5afd7b1dceac..5f67fba07ab4 100644
--- a/fs/btrfs/transaction.h
+++ b/fs/btrfs/transaction.h
@@ -84,6 +84,7 @@ struct btrfs_trans_handle {
84 84
85struct btrfs_pending_snapshot { 85struct btrfs_pending_snapshot {
86 struct dentry *dentry; 86 struct dentry *dentry;
87 struct inode *dir;
87 struct btrfs_root *root; 88 struct btrfs_root *root;
88 struct btrfs_root *snap; 89 struct btrfs_root *snap;
89 struct btrfs_qgroup_inherit *inherit; 90 struct btrfs_qgroup_inherit *inherit;