Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 71455
b: refs/heads/master
c: 6f4e643
h: refs/heads/master
i:
  71453: a4cbfda
  71451: f5585ec
  71447: ea78ba4
  71439: a271650
  71423: a710eea
v: v3
  • Loading branch information
Pavel Emelyanov authored and Linus Torvalds committed Oct 19, 2007
1 parent a68d80d commit 33084fd
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 130f77ecb2e7d5ac3e53e620f55e374f4a406b20
refs/heads/master: 6f4e643353aea52d80f33960bd88954a7c074f0f
4 changes: 4 additions & 0 deletions trunk/fs/proc/base.c
Original file line number Diff line number Diff line change
Expand Up @@ -2275,6 +2275,10 @@ void proc_flush_task(struct task_struct *task)
proc_flush_task_mnt(upid->ns->proc_mnt, upid->nr,
leader ? 0 : tgid->numbers[i].nr);
}

upid = &pid->numbers[pid->level];
if (upid->nr == 1)
pid_ns_release_proc(upid->ns);
}

static struct dentry *proc_pid_instantiate(struct inode *dir,
Expand Down
16 changes: 16 additions & 0 deletions trunk/fs/proc/root.c
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,22 @@ struct proc_dir_entry proc_root = {
.parent = &proc_root,
};

int pid_ns_prepare_proc(struct pid_namespace *ns)
{
struct vfsmount *mnt;

mnt = kern_mount_data(&proc_fs_type, ns);
if (IS_ERR(mnt))
return PTR_ERR(mnt);

return 0;
}

void pid_ns_release_proc(struct pid_namespace *ns)
{
mntput(ns->proc_mnt);
}

EXPORT_SYMBOL(proc_symlink);
EXPORT_SYMBOL(proc_mkdir);
EXPORT_SYMBOL(create_proc_entry);
Expand Down
12 changes: 12 additions & 0 deletions trunk/include/linux/proc_fs.h
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,9 @@ extern const struct file_operations proc_kcore_operations;
extern const struct file_operations proc_kmsg_operations;
extern const struct file_operations ppc_htab_operations;

extern int pid_ns_prepare_proc(struct pid_namespace *ns);
extern void pid_ns_release_proc(struct pid_namespace *ns);

/*
* proc_tty.c
*/
Expand Down Expand Up @@ -235,6 +238,15 @@ static inline void proc_tty_unregister_driver(struct tty_driver *driver) {};

extern struct proc_dir_entry proc_root;

static inline int pid_ns_prepare_proc(struct pid_namespace *ns)
{
return 0;
}

static inline void pid_ns_release_proc(struct pid_namespace *ns)
{
}

#endif /* CONFIG_PROC_FS */

#if !defined(CONFIG_PROC_KCORE)
Expand Down
7 changes: 7 additions & 0 deletions trunk/kernel/fork.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
#include <linux/taskstats_kern.h>
#include <linux/random.h>
#include <linux/tty.h>
#include <linux/proc_fs.h>

#include <asm/pgtable.h>
#include <asm/pgalloc.h>
Expand Down Expand Up @@ -1150,6 +1151,12 @@ static struct task_struct *copy_process(unsigned long clone_flags,
pid = alloc_pid(task_active_pid_ns(p));
if (!pid)
goto bad_fork_cleanup_namespaces;

if (clone_flags & CLONE_NEWPID) {
retval = pid_ns_prepare_proc(task_active_pid_ns(p));
if (retval < 0)
goto bad_fork_free_pid;
}
}

p->pid = pid_nr(pid);
Expand Down

0 comments on commit 33084fd

Please sign in to comment.