Re: [PATCH 3/3] exec: Allow do_coredump to wait for user space pipe readers to complete (v8)

Oleg Nesterov
2009-07-07T16:39:06Z

On 07/07, Neil Horman wrote:
>
> > +static void wait_for_dump_helpers(struct file *file)
> > +{
> > + struct pipe_inode_info *pipe;
> > +
> > + pipe = file->f_path.dentry->d_inode->i_pipe;
> > +
> > + pipe_lock(pipe);
> > + pipe->readers++;
> > + pipe->writers--;
> > +
> > + while ((pipe->readers > 1) && (!signal_pending(current))) {
> > + wake_up_interruptible_sync(&pipe->wait);
> > + kill_fasync(&pipe->fasync_readers, SIGIO, POLL_IN);
> > + pipe_wait(pipe);
> > + }
> > +
> > + pipe->readers--;
> > + pipe->writers++;
> > + pipe_unlock(pipe);
> > +
> > +}
> > +
> > +
> > void do_coredump(long signr, int exit_code, struct pt_regs *regs)
> > {
> > struct core_state core_state;
> > @@ -1862,6 +1886,8 @@ void do_coredump(long signr, int exit_code, struct pt_regs *regs)
> > current->signal->group_exit_code |= 0x80;
> >
> > close_fail:
> > + if (ispipe && core_pipe_limit)
> > + wait_for_dump_helpers(file);

Looks good to me.

As for "&& core_pipe_limit" here, I agree this is subjective and I see
your point.

Oleg.