All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Woodhouse <dwmw2@infradead.org>
To: Trond Myklebust <trond.myklebust@fys.uio.no>
Cc: Jamie Lokier <jamie@shareable.org>,
	Steve French <smfltc@us.ibm.com>,
	linux-fsdevel@vger.kernel.org
Subject: Re: filesystem signal handling
Date: Thu, 29 Apr 2004 07:41:59 +0100	[thread overview]
Message-ID: <1083220919.4694.59.camel@localhost.localdomain> (raw)
In-Reply-To: <1083207196.2856.220.camel@lade.trondhjem.org>

On Wed, 2004-04-28 at 22:53 -0400, Trond Myklebust wrote:
> One of the main points of playing with the sigmask in the first place is
> that interrupting an operation in the middle of the RPC call leaves
> various attribute/data caches in an incoherent state, and so is in
> general bad practice.

We can generalise that. The main reason for blocking signals -- be it by
using TASK_UNINTERRUPTIBLE, manipulating the sigmask, or some
hypothetical 'uninterruptible_count' in the task_struct, is that in some
places we either can't or don't want to clean up properly if a signal
happens. Sometimes that requirement comes all the way from userspace
(e.g. expected semantics of sys_read() and short reads)

In those problematic cases, we often call other functions which may
sleep any may potentially be interrupted -- since we can't handle that,
we obviously require them _not_ to be interrupted. But making those
functions use TASK_UNINTERRUPTIBLE means that they can't be interrupted
even when called by other callers which _could_ clean up after
themselves -- unless we do something horrid like passing a flag all the
way down to say what sleep state should be used. 

The advantage of doing it with the latter two methods mentioned above is
that the 'problematic' routine can make that decision for itself and set
some state, and then the routines which it calls don't need to care.
They just _don't_ get interrupted when they're called from a function
which cannot handle receiving -EINTR.

> We certainly don't want something like a poorly
> coded application that generates the occasional SIGSEGV or SIGBUS (or
> even a well-coded one that uses timers + SIGALRM!) to screw up the
> cached data/metadata for everyone else.

If that's a possible outcome, why doesn't that happen with uncaught
SIGINT? 

-- 
dwmw2


  reply	other threads:[~2004-04-29  6:42 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-04-27 16:20 filesystem behavior when low on memory and PF_MEMALLOC Steve French
2004-04-27 19:09 ` Bryan Henderson
2004-04-27 20:29   ` filesystem signal handling Steve French
2004-04-28 15:14     ` David Woodhouse
2004-04-28 17:05       ` Trond Myklebust
2004-04-28 17:14         ` David Woodhouse
2004-04-28 17:32           ` Trond Myklebust
2004-04-28 19:28             ` Jamie Lokier
2004-04-28 19:43               ` Trond Myklebust
2004-04-28 19:47                 ` Jamie Lokier
2004-04-28 20:31                   ` Trond Myklebust
2004-04-29  2:18               ` David Woodhouse
2004-04-29  2:53                 ` Trond Myklebust
2004-04-29  6:41                   ` David Woodhouse [this message]
2004-04-29 17:41                     ` Bryan Henderson
2004-04-28 21:46       ` Bryan Henderson
2004-04-29  2:34         ` David Woodhouse

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=1083220919.4694.59.camel@localhost.localdomain \
    --to=dwmw2@infradead.org \
    --cc=jamie@shareable.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=smfltc@us.ibm.com \
    --cc=trond.myklebust@fys.uio.no \
    /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.