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
parentBtrfs: Add backrefs and forward refs for subvols and snapshots (diff)
downloadlinux-dev-ea9e8b11bd1252dcbc23afefcf1a52ec6aa3c113.tar.xz
linux-dev-ea9e8b11bd1252dcbc23afefcf1a52ec6aa3c113.zip
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,
kfree(root);
return ERR_PTR(ret);
}
-
+#if 0
ret = btrfs_sysfs_add_root(root);
if (ret) {
free_extent_buffer(root->node);
@@ -1137,6 +1137,7 @@ struct btrfs_root *btrfs_read_fs_root(struct btrfs_fs_info *fs_info,
kfree(root);
return ERR_PTR(ret);
}
+#endif
root->in_sysfs = 1;
return root;
}
@@ -1963,8 +1964,10 @@ int btrfs_free_fs_root(struct btrfs_fs_info *fs_info, struct btrfs_root *root)
down_write(&root->anon_super.s_umount);
kill_anon_super(&root->anon_super);
}
+#if 0
if (root->in_sysfs)
btrfs_sysfs_del_root(root);
+#endif
if (root->node)
free_extent_buffer(root->node);
if (root->commit_root)