Re: [] Kernel coredump to a pipe is failing

From: Jesper Juhl
Date: Wed May 27 2009 - 16:32:41 EST

On Wed, 27 May 2009, Andi Kleen wrote:

> On Tue, May 26, 2009 at 04:28:21PM -0700, Andrew Morton wrote:
> > On Wed, 27 May 2009 01:14:28 +0200
> > Andi Kleen <andi@xxxxxxxxxxxxxx> wrote:
> >
> > > On Tue, May 26, 2009 at 04:00:17PM -0700, Andrew Morton wrote:
> > > > dump_write() doesn't seem right, either. If ->write() returns, say,
> > > > 100 then the dump should keep on going. At present it treats this
> > > > return as an error.
> > >
> > > I think that's correct actually. Short write typically means serious
> > > issue like disk full or broken pipe, so stopping is good.
> >
> > But we shouldn't assume that. It could be that the ->write
> > implementation is perfectly able to absorb the remaining data.
> Maybe in theory, but in practice that's unlikely isn't it?
> Disk is full or pipe is blocking etc.
> > We should only error out of the write() returned zero or -EFOO.
> > The current code is simply buggy, but got lucky.
> Maybe very pedantically, but I would argue that most programs
> don't do what you're saying (retry on any short write) and
> it's actually not very nice to always write a loop for each write.
My experience, from userspace, both with the codebases I currently work on
professionally and my own hobby projects, is that people usually write a
"write wrapper" function that deals with short writes, interrupted system
call etc and then just call the wrapper so one does not have to open-code
a loop everywhere one wants to call write() - one just calls the wrapper
function that does the right thing.

Jesper Juhl <jj@xxxxxxxxxxxxx>
Plain text mails only, please
Don't top-post

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at