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

From: Oleg Nesterov
Date: Tue Jul 07 2009 - 12:39:07 EST


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.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/