aboutsummaryrefslogtreecommitdiffstats
path: root/fs/namespace.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/namespace.c')
-rw-r--r--fs/namespace.c68
1 files changed, 0 insertions, 68 deletions
diff --git a/fs/namespace.c b/fs/namespace.c
index f7ec283ccfbb..1e56303c718e 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -2093,74 +2093,6 @@ out1:
2093} 2093}
2094 2094
2095/* 2095/*
2096 * Replace the fs->{rootmnt,root} with {mnt,dentry}. Put the old values.
2097 * It can block. Requires the big lock held.
2098 */
2099void set_fs_root(struct fs_struct *fs, struct path *path)
2100{
2101 struct path old_root;
2102
2103 write_lock(&fs->lock);
2104 old_root = fs->root;
2105 fs->root = *path;
2106 path_get(path);
2107 write_unlock(&fs->lock);
2108 if (old_root.dentry)
2109 path_put(&old_root);
2110}
2111
2112/*
2113 * Replace the fs->{pwdmnt,pwd} with {mnt,dentry}. Put the old values.
2114 * It can block. Requires the big lock held.
2115 */
2116void set_fs_pwd(struct fs_struct *fs, struct path *path)
2117{
2118 struct path old_pwd;
2119
2120 write_lock(&fs->lock);
2121 old_pwd = fs->pwd;
2122 fs->pwd = *path;
2123 path_get(path);
2124 write_unlock(&fs->lock);
2125
2126 if (old_pwd.dentry)
2127 path_put(&old_pwd);
2128}
2129
2130static void chroot_fs_refs(struct path *old_root, struct path *new_root)
2131{
2132 struct task_struct *g, *p;
2133 struct fs_struct *fs;
2134 int count = 0;
2135
2136 read_lock(&tasklist_lock);
2137 do_each_thread(g, p) {
2138 task_lock(p);
2139 fs = p->fs;
2140 if (fs) {
2141 write_lock(&fs->lock);
2142 if (fs->root.dentry == old_root->dentry
2143 && fs->root.mnt == old_root->mnt) {
2144 path_get(new_root);
2145 fs->root = *new_root;
2146 count++;
2147 }
2148 if (fs->pwd.dentry == old_root->dentry
2149 && fs->pwd.mnt == old_root->mnt) {
2150 path_get(new_root);
2151 fs->pwd = *new_root;
2152 count++;
2153 }
2154 write_unlock(&fs->lock);
2155 }
2156 task_unlock(p);
2157 } while_each_thread(g, p);
2158 read_unlock(&tasklist_lock);
2159 while (count--)
2160 path_put(old_root);
2161}
2162
2163/*
2164 * pivot_root Semantics: 2096 * pivot_root Semantics:
2165 * Moves the root file system of the current process to the directory put_old, 2097 * Moves the root file system of the current process to the directory put_old,
2166 * makes new_root as the new root file system of the current process, and sets 2098 * makes new_root as the new root file system of the current process, and sets