The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Daniel Phillips <phillips@bonn-fries.net>
To: Pavel Machek <pavel@suse.cz>, Alexander Viro <viro@math.psu.edu>
Cc: Chris Wedgwood <cw@f00f.org>, Andrea Arcangeli <andrea@suse.de>,
	Jens Axboe <axboe@suse.de>, Rogier Wolff <R.E.Wolff@BitWizard.nl>,
	Linus Torvalds <torvalds@transmeta.com>,
	Alan Cox <alan@lxorguk.ukuu.org.uk>,
	volodya@mindspring.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] SMP race in ext2 - metadata corruption.
Date: Fri, 11 May 2001 16:54:44 +0200	[thread overview]
Message-ID: <01051116544400.01990@starship> (raw)
In-Reply-To: <20010506153218.A11911@tapu.f00f.org> <Pine.GSO.4.21.0105052338580.26799-100000@weyl.math.psu.edu> <20010507184224.A32@(none)>
In-Reply-To: <20010507184224.A32@(none)>

On Monday 07 May 2001 20:42, Pavel Machek wrote:
> > >     It's not exactly "kernel-based fsck". What I've been talking
> > > about is secondary filesystem providing coherent access to
> > > primary fs metadata.  I.e. mount -t ext2meta -o master=/usr none
> > > /mnt and then access through /mnt/super, /mnt/block_bitmap, etc.
> > >
> > > Call me stupid --- but what exactly does the above actually
> > > achieve? Why would you do this?
> >
> > Coherent access to metadata? Well, for one thing, it allows stuff
> > like tunefs and friends on mounted fs. What's more useful, it
> > allows to do things like access to boot code, which is _not_ safe
> > to do through device access - usually you have superblock in
> > vicinity and no warranties about the things that will be
> > overwritten on umount. Same for debugging stuff, IO stats, etc. -
> > access through secondary tree is much saner than inventing tons of
> > ioctls for dealing with that. Moreover, it allows fsck and friends
> > to get rid of code duplication - while the repair logics, etc.
> > stays in userland (where it belongs) layout information is already
> > handled in the kernel. No need to duplicate it in userland...
>
> OTOH with current way if you make mistake in kernel, fsck will not
> automatically inherit it; therefore fsck is likely to work even if
> kernel ext2 is b0rken [and that's fairly important]

Al's idea ncely dances around a big problem with the page cache: there 
is no efficient way to know which address_space a given physical block 
belongs to.   It *might* be nice to have such capability in a 
fs-independent way.  We could do that now, very inefficiently, by 
searching all the address_spaces (i.e., inodes) for the physical block. 
We'd have to prevent further page cache operations while we did that, 
and when we add fs-private address_spaces some more mechanism would be 
required..  So: slow, intrusive and fragile.

The only reasonable way I can think of getting a block-coherent view 
underneath a mounted fs is to have a reverse map, and update it each 
time we map block into the page cache or unmap it.  The reverse map 
would tell us if a given physical block is currently in the page 
cache,and if so, which address_space it belongs to.  A blocks not 
currently mapped into any address_space could be mapped into an 
'anonymous' space covering the entire partition and moved automatically 
to the correct address_space when the fs tries to map it.

The big problem with this mechanism is it slows down the common case, 
which works perfectly well without any reverse map.  Not to mention 
adding bloat.  So the next question I thought about was, is there a way 
to switch on a page cache reverse map just when needed and do that in a 
generic way.  I convinced myself it wouldn't be too hard,  but then 
there's another question: how badly do we need this?

Al's idea does let us get at some of the specific parts of the fs 
metadata but it has its problems too.  We'd need to exhaustively 
enumerate every kind of filesystem metadata that could reasonably be 
accessed underneath the filesystem, and special-case it, not so nice.

But I couldn't come up with any killer examples where we'd really need 
a generalized, coherent view underneath a mounted filesystem, so I put 
these thoughts on hold.   Your borked-fs example sounds interesting, 
have you got more of those?

One more example I can suggest is: right now we have to way of 
detecting an error condition where the same fs block is mapped into 
more than one address_space.  A page cache reverse map could detect 
this easily and would be a really useful debugging tool.

--
Daniel

  reply	other threads:[~2001-05-11 14:56 UTC|newest]

Thread overview: 90+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-04-26 15:45 [PATCH] SMP race in ext2 - metadata corruption Alexander Viro
2001-04-26 18:12 ` Andrea Arcangeli
2001-04-26 18:24   ` Alexander Viro
2001-04-26 19:00     ` Chris Mason
2001-04-26 18:49   ` Linus Torvalds
2001-04-26 19:08     ` Alexander Viro
2001-04-26 19:17       ` Alexander Viro
2001-04-26 20:06         ` Andrea Arcangeli
2001-04-26 19:15     ` Andrea Arcangeli
2001-04-26 19:34       ` Alexander Viro
2001-04-26 19:44         ` Andrea Arcangeli
2001-04-26 19:55           ` Alexander Viro
2001-04-26 20:08             ` Linus Torvalds
2001-04-26 20:21               ` Andrea Arcangeli
2001-04-26 20:49               ` Alexander Viro
2001-04-26 21:07                 ` Andrea Arcangeli
2001-04-26 23:25                   ` Alexander Viro
2001-04-27  0:05                     ` Andrea Arcangeli
2001-04-27  0:19                       ` Linus Torvalds
2001-04-27  0:35                         ` Andrea Arcangeli
2001-04-26 21:13               ` Andrzej Krzysztofowicz
2001-04-27 18:02                 ` LA Walsh
2001-04-27 18:17                   ` dek_ml
2001-04-27  7:58               ` Vojtech Pavlik
2001-04-27 13:23                 ` Alexander Viro
2001-04-27 14:32                   ` Ville Herva
2001-04-27 16:52                 ` Linus Torvalds
2001-04-27 19:22                   ` Shane Wegner
2001-04-28  4:55                   ` Albert D. Cahalan
2001-04-28 10:05                     ` Jens Axboe
2001-04-27 14:29               ` Andi Kleen
2001-05-03  6:23               ` volodya
2001-05-03  9:29                 ` Alan Cox
2001-05-03 17:21                   ` Linus Torvalds
2001-05-04 11:40                     ` Rogier Wolff
2001-05-04 11:56                       ` Jens Axboe
2001-05-04 15:29                         ` Andrea Arcangeli
2001-05-04 17:40                           ` Linus Torvalds
2001-05-05  3:18                           ` Chris Wedgwood
2001-05-06  0:37                             ` Andrea Arcangeli
2001-05-06  2:14                               ` Chris Wedgwood
2001-05-06  2:50                                 ` Andrea Arcangeli
2001-05-06  3:00                                   ` Chris Wedgwood
2001-05-06  3:15                                     ` Alexander Viro
2001-05-06  3:32                                       ` Chris Wedgwood
2001-05-06  3:59                                         ` Alexander Viro
2001-05-06 12:47                                           ` Alan Cox
2001-05-06 19:46                                             ` Andreas Dilger
2001-05-06 20:58                                               ` Alan Cox
2001-05-07  4:08                                                 ` Andreas Dilger
2001-05-07 18:42                                           ` Pavel Machek
2001-05-11 14:54                                             ` Daniel Phillips [this message]
2001-05-18 14:46                                               ` Stephen C. Tweedie
2001-05-11 20:00                                             ` Alexander Viro
2001-05-06  3:38                                     ` Andreas Dilger
2001-05-06  3:51                                     ` Andrea Arcangeli
2001-05-04 12:15                       ` Marc SCHAEFER
2001-05-04 17:28                       ` Linus Torvalds
2001-05-04 17:39                         ` Alexander Viro
2001-05-04 17:55                           ` Linus Torvalds
2001-05-04 18:29                             ` Alexander Viro
2001-05-04 19:13                               ` Linus Torvalds
2001-05-05 11:20                               ` Albert D. Cahalan
2001-05-05 17:11                                 ` Alexander Viro
2001-05-04 18:20                         ` Richard Gooch
2001-05-04 18:35                           ` Alexander Viro
2001-05-04 18:49                             ` Richard Gooch
2001-05-04 19:15                               ` Alexander Viro
2001-05-04 19:36                                 ` Richard Gooch
2001-05-04 19:58                                   ` Alexander Viro
2001-05-04 20:04                                     ` Richard Gooch
2001-05-04 19:04                           ` Jens Axboe
2001-05-05 13:52                           ` Rogier Wolff
2001-05-05 18:12                             ` Richard Gooch
2001-05-08 13:46                           ` volodya
2001-05-09 10:30                             ` Helge Hafting
2001-05-04 21:11                         ` Alan Cox
2001-05-04 21:50                           ` Linus Torvalds
2001-04-26 20:11             ` Andrea Arcangeli
2001-04-26 20:14               ` Andrea Arcangeli
2001-04-26 20:26               ` Linus Torvalds
2001-04-26 21:16                 ` Andrea Arcangeli
2001-04-26 20:42         ` Richard B. Johnson
2001-04-26 20:55           ` Alexander Viro
2001-04-27 11:43             ` Richard B. Johnson
2001-04-26 19:39       ` Andrea Arcangeli
     [not found] <Pine.LNX.4.21.0104270953280.2067-100000@penguin.transmeta.com>
2001-04-27 17:36 ` Jeff Garzik
     [not found] ` <3AE9A69B.D11F0BBD@evision-ventures.com>
2001-04-28  8:31   ` Matthias Urlichs
2001-04-28 13:20   ` Olaf Titz
2001-04-30  8:47 ` Neil Conway

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=01051116544400.01990@starship \
    --to=phillips@bonn-fries.net \
    --cc=R.E.Wolff@BitWizard.nl \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=andrea@suse.de \
    --cc=axboe@suse.de \
    --cc=cw@f00f.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pavel@suse.cz \
    --cc=torvalds@transmeta.com \
    --cc=viro@math.psu.edu \
    --cc=volodya@mindspring.com \
    /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