Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 139854
b: refs/heads/master
c: f8ef3ed
h: refs/heads/master
v: v3
  • Loading branch information
Al Viro committed Apr 1, 2009
1 parent 5138dcb commit 386edd1
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 10 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: 11d06b2a1e5658f448a308aa3beb97bacd64a940
refs/heads/master: f8ef3ed2bebd2c4cb9ece92efa185d7aead8831a
26 changes: 17 additions & 9 deletions trunk/fs/namespace.c
Original file line number Diff line number Diff line change
Expand Up @@ -2131,25 +2131,33 @@ static void chroot_fs_refs(struct path *old_root, struct path *new_root)
{
struct task_struct *g, *p;
struct fs_struct *fs;
int count = 0;

read_lock(&tasklist_lock);
do_each_thread(g, p) {
task_lock(p);
fs = p->fs;
if (fs) {
atomic_inc(&fs->count);
task_unlock(p);
write_lock(&fs->lock);
if (fs->root.dentry == old_root->dentry
&& fs->root.mnt == old_root->mnt)
set_fs_root(fs, new_root);
&& fs->root.mnt == old_root->mnt) {
path_get(new_root);
fs->root = *new_root;
count++;
}
if (fs->pwd.dentry == old_root->dentry
&& fs->pwd.mnt == old_root->mnt)
set_fs_pwd(fs, new_root);
put_fs_struct(fs);
} else
task_unlock(p);
&& fs->pwd.mnt == old_root->mnt) {
path_get(new_root);
fs->pwd = *new_root;
count++;
}
write_unlock(&fs->lock);
}
task_unlock(p);
} while_each_thread(g, p);
read_unlock(&tasklist_lock);
while (count--)
path_put(old_root);
}

/*
Expand Down

0 comments on commit 386edd1

Please sign in to comment.