All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Andi Kleen <andi@firstfloor.org>
Cc: paul@mad-scientist.net, linux-kernel@vger.kernel.org
Subject: Re: [2.6.27.24] Kernel coredump to a pipe is failing
Date: Wed, 27 May 2009 01:56:47 -0700	[thread overview]
Message-ID: <20090527015647.325b892f.akpm@linux-foundation.org> (raw)
In-Reply-To: <20090527085237.GV846@one.firstfloor.org>

On Wed, 27 May 2009 10:52:38 +0200 Andi Kleen <andi@firstfloor.org> wrote:

> > Hey, don't look at me - blame Brian Kernighan or George Bush or
> > someone.
> 
> Heh.
> 
> What I meant is: if it makes sense to retry the kernel should do that
> on its own. It has better information about the circumstances anyways.
> And it would make sense to put all such logic into a single place
> instead of all programs.
> 
> If it doesn't we shouldn't try to force that to user space. That would be similar
> to signal handling without SA_RESTART which I think nearly everyone agrees was one
> of the worst APIs in Unix ever.
> 
> In most cases (e.g. out of memory) it likely doesn't make much sense to
> retry anyways.
> 
> So short write always means error.
> 
> 
> > > And the same applies to in-kernel users really.
> > 
> > We could delete a rather nice amount of tricky VFS code if we were to
> > make this assumption.  But of course we daren't do that.
> 
> What do you mean?

There's code all over the VFS IO paths which correctly recognises,
handles and propagates short reads and writes.

Actually, by far the most common case here is that the short read/write
will be followed by a -ENOSPC or -EFAULT or whatever, so forget I said
that ;)

> > 
> > And as long as we're attempting to correctly handle partial writes all
> > over the kernel, it's a bit dopey to deliberately avoid doing this at one
> > particular codesite.
> > 
> > I bet glibc handles partial writes...
> 
> I just spent some time nagivating through the glibc stdio me^wmaze 
> and I don't see any retry loops.

Perhaps it's usually propagated back, dunno.

> Also even if it did there would be lots of other users
> (google codesearch has >23 million hits for "write")
> 
> > > a lot of things start failing.
> > 
> > The kernel should only fail if it has no other option.
> 
> Typically short write means no other option.

typically != always.  It would certainly be peculiar behaviour and
perhaps it was specified that way mainly on behalf of UART drivers and
such, dunno.


  reply	other threads:[~2009-05-27  8:57 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-26 16:33 [2.6.27.24] Kernel coredump to a pipe is failing Paul Smith
2009-05-26 18:01 ` Paul Smith
2009-05-26 20:31 ` Andi Kleen
2009-05-26 21:09   ` Paul Smith
2009-05-26 23:00   ` Andrew Morton
2009-05-26 23:14     ` Andi Kleen
2009-05-26 23:28       ` Andrew Morton
2009-05-26 23:41         ` Andi Kleen
2009-05-26 23:45           ` Andrew Morton
2009-05-27  0:11             ` Andi Kleen
2009-05-27  0:29               ` Andrew Morton
2009-05-27  6:02                 ` Paul Smith
2009-05-27  6:17                 ` Paul Smith
2009-05-27  7:31                 ` Andi Kleen
2009-05-27  7:45                   ` Andrew Morton
2009-05-27  8:52                     ` Andi Kleen
2009-05-27  8:56                       ` Andrew Morton [this message]
2009-05-27 20:25           ` Jesper Juhl
2009-05-29 10:34           ` Pavel Machek
2009-05-27 18:31   ` Oleg Nesterov
2009-05-27 18:50     ` Andi Kleen
2009-05-27 19:05       ` Oleg Nesterov
2009-05-27 19:49         ` Paul Smith
2009-05-27 20:34           ` Oleg Nesterov
2009-05-27 20:04     ` Oleg Nesterov
2009-05-27 20:22       ` Paul Smith
  -- strict thread matches above, loose matches on Subject: below --
2009-05-22 12:34 Paul Smith

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090527015647.325b892f.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=andi@firstfloor.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=paul@mad-scientist.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.