lkml.org 
[lkml]   [2011]   [Dec]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] fs, proc: Introduce the /proc/<pid>/children entry v2
On Wed, Dec 07, 2011 at 07:53:43PM +0100, Oleg Nesterov wrote:
> Hi Cyrill,
>
> Sorry, I didn't read this patch yet, but
>
> On 12/06, Cyrill Gorcunov wrote:
> >
> > +static void *children_seq_start(struct seq_file *seq, loff_t *pos)
> > +{
> > + struct task_struct *task;
> > +
> > + rcu_read_lock();
> > + task = seq->private;
> > + if (task)
> > + return seq_list_start(&task->children, *pos);
>
> This looks "obviously wrong".
>
> We can not trust ->children->next after rcu_read_unlock(). Another
> rcu_read_lock() can't help.
>
> Once again, I can be easily wrong, need to read the patch first.
>

Wait, Oleg, I might be wrong as well, but it's now as

children_seq_open
get_proc_task (so ref to task increased)

the children_seq_start/children_seq_stop works
in iteration and every new iteration seq_list_next
walks over the whole children list from the list
head under rcu lock, so even if task is removed
or added the link should exsist until rcu is unlocked
and sync'ed no?

Cyrill


\
 
 \ /
  Last update: 2011-12-07 20:05    [from the cache]
©2003-2014 Jasper Spaans. Advertise on this site