aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/disk-io.c
diff options
context:
space:
mode:
authorChris Mason <chris.mason@oracle.com>2008-11-17 21:14:24 -0500
committerChris Mason <chris.mason@oracle.com>2008-11-17 21:14:24 -0500
commitea9e8b11bd1252dcbc23afefcf1a52ec6aa3c113 (patch)
tree3573c8d79e1936e8c921a3be77abda35124e0d78 /fs/btrfs/disk-io.c
parent0660b5af3f7ac0fac69de975914e1f4a3a586fb3 (diff)
Btrfs: prevent loops in the directory tree when creating snapshots
For a directory tree: /mnt/subvolA/subvolB btrfsctl -s /mnt/subvolA/subvolB /mnt Will create a directory loop with subvolA under subvolB. This commit uses the forward refs for each subvol and snapshot to error out before creating the loop. Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/disk-io.c')
-rw-r--r--fs/btrfs/disk-io.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index 8d7866b733d6..e18250a6fd2d 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -1129,7 +1129,7 @@ struct btrfs_root *btrfs_read_fs_root(struct btrfs_fs_info *fs_info,
1129 kfree(root); 1129 kfree(root);
1130 return ERR_PTR(ret); 1130 return ERR_PTR(ret);
1131 } 1131 }
1132 1132#if 0
1133 ret = btrfs_sysfs_add_root(root); 1133 ret = btrfs_sysfs_add_root(root);
1134 if (ret) { 1134 if (ret) {
1135 free_extent_buffer(root->node); 1135 free_extent_buffer(root->node);
@@ -1137,6 +1137,7 @@ struct btrfs_root *btrfs_read_fs_root(struct btrfs_fs_info *fs_info,
1137 kfree(root); 1137 kfree(root);
1138 return ERR_PTR(ret); 1138 return ERR_PTR(ret);
1139 } 1139 }
1140#endif
1140 root->in_sysfs = 1; 1141 root->in_sysfs = 1;
1141 return root; 1142 return root;
1142} 1143}
@@ -1963,8 +1964,10 @@ int btrfs_free_fs_root(struct btrfs_fs_info *fs_info, struct btrfs_root *root)
1963 down_write(&root->anon_super.s_umount); 1964 down_write(&root->anon_super.s_umount);
1964 kill_anon_super(&root->anon_super); 1965 kill_anon_super(&root->anon_super);
1965 } 1966 }
1967#if 0
1966 if (root->in_sysfs) 1968 if (root->in_sysfs)
1967 btrfs_sysfs_del_root(root); 1969 btrfs_sysfs_del_root(root);
1970#endif
1968 if (root->node) 1971 if (root->node)
1969 free_extent_buffer(root->node); 1972 free_extent_buffer(root->node);
1970 if (root->commit_root) 1973 if (root->commit_root)