linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Theodore Tso <tytso@mit.edu>
Cc: Wu Fengguang <fengguang.wu@intel.com>, Jan Kara <jack@suse.cz>,
	Christoph Hellwig <hch@infradead.org>,
	Al Viro <viro@ZenIV.linux.org.uk>,
	"linux-fsdevel@vger.kernel.org" <linux-fsdevel@vger.kernel.org>
Subject: Re: [PATCH 2/2] Make write(2) interruptible by a signal
Date: Wed, 23 Nov 2011 12:29:48 -0800	[thread overview]
Message-ID: <20111123122948.4aa7ddfa.akpm@linux-foundation.org> (raw)
In-Reply-To: <BE9807BA-82BE-451D-AAEC-9D51010C16C6@mit.edu>

On Wed, 23 Nov 2011 07:27:43 -0500
Theodore Tso <tytso@mit.edu> wrote:

> >> 
> >> Maybe this is not that big problem as SIGKILL is considered be to
> >> destructive already.
> > 
> > Yeah, I have dim dark memories that there are subtle problems with
> > interrupting write().  Linus might remember.

(err, you're sending 600-column emails)

> The big one is that you're lucky if application programmers check the
> return values of write(2), and if they do, it's likely they will only
> check for error returns and not necessarily for partial writes ---
> since no other Unix-like or Linux-like system has ever returned partial
> reads or writes for files except in error conditions.  We've barely
> gotten them trained to check for partial writes and reads with TCP
> connections and character devices, but I wouldn't bet on application
> programmers getting things right for files.
> 
> Still, if it's ***only*** for SIGKILL, we'll probably be OK, since
> for that one case there's no chance userspace can intercept the signal,
> so it can't do any recovery anyway.  (I could imagine some HPC program
> doing a massive 2GB write, and some user of that program depending on
> the fact that he can kill it at a predefined place by sending a SIGKILL
> and knowing that the file would be written up to that 2GB chunk --- but
> that's clearly an edge situation, as opposed to something that would
> effect most GNOME and KDE apps.) We just need to make sure we never try
> to do this for any other signal that could be caught, such as SIGINT or
> SIGQUIT or (worse yet) SIGTSTP.

That it is a fatal SIGKILL means that the *current* application doesn't
care.  But other processes will sometimes notice this change. 
Previously if an app did write(file, 128k) and was hit with SIGKILL, it
would write either 0 bytes or 128k bytes.  Now, it can write 36k bytes,
yes?  If the target file consisted of a stream of 128k records then the
user will claim, with some justification, that Linux corrupted it.

Dunno.  People do lots of weird and flakey things.  I have a suspicion
that we'll be hearing back from them about this change.

  reply	other threads:[~2011-11-23 20:29 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-16 11:12 [PATCH 0/2 v3] Make task in balance_dirty_pages() killable Jan Kara
2011-11-16 11:12 ` [PATCH 1/2] mm: " Jan Kara
2011-11-16 11:28   ` Wu Fengguang
2011-11-16 12:58     ` Jan Kara
2011-11-16 11:12 ` [PATCH 2/2] fs: Make write(2) interruptible by a signal Jan Kara
2011-11-16 11:44   ` Wu Fengguang
2011-11-16 12:54     ` Jan Kara
2011-11-16 13:11       ` Wu Fengguang
2011-11-22 22:28     ` Andrew Morton
2011-11-23  9:05       ` Wu Fengguang
2011-11-23  9:50         ` Andrew Morton
2011-11-23 12:27           ` [PATCH 2/2] " Theodore Tso
2011-11-23 20:29             ` Andrew Morton [this message]
2011-11-24 19:27               ` Matthew Wilcox
2011-11-24 20:53                 ` Ted Ts'o
2011-11-25  0:10                   ` Matthew Wilcox
2011-11-24 20:53                 ` Jan Kara
2011-11-23 13:08         ` [PATCH 2/2] fs: " Jan Kara
2011-11-23 13:27           ` Wu Fengguang
2011-11-23 15:06             ` Theodore Tso
2011-11-28  3:08               ` Wu Fengguang
2011-11-28  3:33                 ` [PATCH] writeback: add a safety limit to the SIGKILL abort Wu Fengguang
2011-11-29 14:18                   ` Jan Kara
2011-11-29 14:16                 ` [PATCH 2/2] fs: Make write(2) interruptible by a signal Jan Kara
2011-11-16 11:23 ` [PATCH 0/2 v3] Make task in balance_dirty_pages() killable Wu Fengguang

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=20111123122948.4aa7ddfa.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=fengguang.wu@intel.com \
    --cc=hch@infradead.org \
    --cc=jack@suse.cz \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=tytso@mit.edu \
    --cc=viro@ZenIV.linux.org.uk \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).