[RFC PATCH 2/3] procfs: show hierarchy of pid namespace
chenhanxiao at cn.fujitsu.com
Thu Sep 11 09:48:51 UTC 2014
> -----Original Message-----
> From: Serge E. Hallyn [mailto:serge at hallyn.com]
> Sent: Thursday, September 11, 2014 12:23 AM
> To: Chen, Hanxiao/陈 晗霄
> Cc: containers at lists.linux-foundation.org; linux-kernel at vger.kernel.org;
> Richard Weinberger; Serge Hallyn; Oleg Nesterov; David Howells; Eric W. Biederman;
> Al Viro
> Subject: Re: [RFC PATCH 2/3] procfs: show hierarchy of pid namespace
> Quoting Chen Hanxiao (chenhanxiao at cn.fujitsu.com):
> > This patch will show the hierarchy of pid namespace
> > under /proc/pidns like:
> > /proc/pidns
> > ├── hierarchy
> > │ ├── pidns4026532399
> > │ │ ├── pidns -> /proc/2863/ns/pid
> > │ │ └── pidns4026532515
> > │ │ └── pidns -> /proc/10611/ns/pid
> > │ └── pidns4026532504
> > │ └── pidns -> /proc/4450/ns/pid
> > └── refresh
> > a) hierarchy dir:
> > use to show hierarchy infomation using dir and symlinks.
> > dirs are named as pidns($inum)
> > a symlink is created under pidns($inum), and linked to
> > that pid namespace.
> > b) refresh
> > trigger key.
> > We need to write sth to /proc/nspid/refresh,
> > then we could get hierarchy info
> > under /proc/pidns/hierarchy.
> Ouch. There may not be a better way, but it sure would be nice if
> we could simply have the list update in real-time.
> If we have to 'echo 1 > /proc/pidns/refresh' to update the fs tree under
> /proc/pidns/ to reflect new pidns activity, then why not just make this
> a text file? I suppose if it were a textfile you'd be encouraging ppl
> to 'cat pidlist | while read line; do grep line /proc/pidns; done',
> which would cause a refresh of that file for every grep?
Let's expose it in a text file
and refresh it when user open it.
It provided fairly the same information as dir trees.
And easy to use too.
> My concern with this approach is that it is unlike any other pseudo-fs
> that I know of, and people may simply expect the fs contents to be
> uptodate rather than a snapshot.
You're right, snapshot is not a good idea.
v2 will use a file /proc/pidns_hierarchy to show.
More information about the Containers