linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@zip.com.au>
To: Joshua Schmidlkofer <menion@srci.iwpsd.org>
Cc: Hans Reiser <reiser@namesys.com>, kernel <linux-kernel@vger.kernel.org>
Subject: Re: ReiserFS / 2.4.6 / Data Corruption
Date: Sat, 28 Jul 2001 02:39:50 +1000	[thread overview]
Message-ID: <3B619956.6AA072F9@zip.com.au> (raw)
In-Reply-To: <Pine.LNX.4.33.0107271515200.10139-100000@devel.blackstar.nl>, <Pine.LNX.4.33.0107271515200.10139-100000@devel.blackstar.nl> <0107270818120A.06707@widmers.oce.srci.oce.int>

Joshua Schmidlkofer wrote:
> 
> I've almost quit using reiser, because everytime I have a power outage, the
> last 2 or three files that I've editted, even ones that I haven't touched in
> a while, will usually be hopelessly corrupted.  The '<file>~' that Emacs
> makes is usually fine though.

It's a matter of timing.  There is a lengthy window where the metadata
is written, but its data is not.  If you crash in this window, the files
contain old data.

You can narrow the window of exposure by fiddling with the
parameters in /proc/sys/vm/bdflush - force a full flush every
five seconds, say.

>   It seems to be that any open file is
> in danger.  I don't know if this is normal, or not, but I switched to XFS on
> several machines.  I have nothing against reiser.  I assumed that these
> problems were due to immaturity....

I'm under the impression that XFS also leaves data in the hands
of the kernel's normal writeback mechanisms and will thus be
exposed to the same problem.  I may be wrong about this.


Here's a ten-minute hack which gives reiserfs a simple `ordered data'
mode.  It simply pushes all the dirty buffers and pages out to disk
before running a commit.  Performance is still OK.

I hit reset partway through a massive file tree copy and every
file which had been copied came up peachy - which is very different
from the behaviour without the patch.  Interestingly, there were
zero truncated files as well.  hmmm...






--- linux-2.4.7/include/linux/fs.h	Sat Jul 21 12:37:14 2001
+++ lk-ext3/include/linux/fs.h	Sat Jul 28 02:37:43 2001
@@ -1061,6 +1061,7 @@ extern int fs_may_remount_ro(struct supe
 extern int try_to_free_buffers(struct page *, unsigned int);
 extern void refile_buffer(struct buffer_head * buf);
 extern void end_buffer_io_sync(struct buffer_head *bh, int uptodate);
+extern int flush_all_but_supers(kdev_t dev);
 
 /* reiserfs_writepage needs this */
 extern void set_buffer_async_io(struct buffer_head *bh) ;
--- linux-2.4.7/include/linux/reiserfs_fs_sb.h	Sat Jul 21 12:37:14 2001
+++ lk-ext3/include/linux/reiserfs_fs_sb.h	Sat Jul 28 02:37:43 2001
@@ -289,6 +289,8 @@ struct reiserfs_sb_info
 				/* To be obsoleted soon by per buffer seals.. -Hans */
     atomic_t s_generation_counter; // increased by one every time the
     // tree gets re-balanced
+
+    int no_sync;
     
     /* session statistics */
     int s_kmallocs;
--- linux-2.4.7/fs/reiserfs/journal.c	Sat Jul 21 12:37:14 2001
+++ lk-ext3/fs/reiserfs/journal.c	Sat Jul 28 02:37:43 2001
@@ -2719,6 +2719,9 @@ static int do_journal_end(struct reiserf
   reiserfs_discard_all_prealloc(th); /* it should not involve new blocks into
 				      * the transaction */
 #endif
+
+  if (!p_s_sb->u.reiserfs_sb.no_sync)
+	flush_all_but_supers(p_s_sb->s_dev);
   
   rs = SB_DISK_SUPER_BLOCK(p_s_sb) ;
   /* setup description block */
--- linux-2.4.7/fs/reiserfs/super.c	Wed Jul  4 18:21:31 2001
+++ lk-ext3/fs/reiserfs/super.c	Sat Jul 28 02:37:43 2001
@@ -116,7 +116,9 @@ void reiserfs_put_super (struct super_bl
   /* note, journal_release checks for readonly mount, and can decide not
   ** to do a journal_end
   */
+  s->u.reiserfs_sb.no_sync = 1;
   journal_release(&th, s) ;
+  s->u.reiserfs_sb.no_sync = 0;
 
   for (i = 0; i < SB_BMAP_NR (s); i ++)
     brelse (SB_AP_BITMAP (s)[i]);
--- linux-2.4.7/fs/buffer.c	Sat Jul 21 12:37:14 2001
+++ lk-ext3/fs/buffer.c	Sat Jul 28 02:37:43 2001
@@ -333,6 +333,18 @@ int fsync_dev(kdev_t dev)
 	return sync_buffers(dev, 1);
 }
 
+int flush_all_but_supers(kdev_t dev)
+{
+	sync_buffers(dev, 0);
+
+	lock_kernel();
+	sync_inodes(dev);
+	DQUOT_SYNC(dev);
+	unlock_kernel();
+
+	return sync_buffers(dev, 1);
+}
+
 /*
  * There's no real reason to pretend we should
  * ever do anything differently
--- linux-2.4.7/kernel/ksyms.c	Sat Jul 21 12:37:14 2001
+++ lk-ext3/kernel/ksyms.c	Sat Jul 28 02:37:43 2001
@@ -161,6 +161,7 @@ EXPORT_SYMBOL(d_lookup);
 EXPORT_SYMBOL(__d_path);
 EXPORT_SYMBOL(mark_buffer_dirty);
 EXPORT_SYMBOL(set_buffer_async_io); /* for reiserfs_writepage */
+EXPORT_SYMBOL(flush_all_but_supers);
 EXPORT_SYMBOL(__mark_buffer_dirty);
 EXPORT_SYMBOL(__mark_inode_dirty);
 EXPORT_SYMBOL(get_empty_filp);

  parent reply	other threads:[~2001-07-27 16:33 UTC|newest]

Thread overview: 140+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-07-18  4:14 ReiserFS / 2.4.6 / Data Corruption Sam Thompson
2001-07-18  5:18 ` Steve Kieu
2001-07-18 16:22   ` Erik Mouw
2001-07-19  2:02     ` Steve Kieu
2001-07-19 13:28       ` Hans Reiser
2001-07-19 15:50       ` Erik Mouw
2001-07-27 12:52     ` bvermeul
2001-07-27 12:55       ` Hans Reiser
2001-07-27 13:24         ` bvermeul
2001-07-27 14:18           ` Joshua Schmidlkofer
2001-07-27 14:55             ` Hans Reiser
2001-07-27 15:02               ` Chris Wedgwood
2001-07-27 16:06                 ` Henning P. Schmiedehausen
2001-07-27 22:02                 ` Luigi Genoni
2001-07-28 13:45               ` Matthew Gardiner
2001-07-28 16:15                 ` Hans Reiser
2001-07-28 16:45                 ` Marcus Meissner
2001-07-28 16:45                 ` Christoph Hellwig
2001-07-29 10:19                   ` Matthew Gardiner
2001-07-29 11:04                     ` Chris Wedgwood
2001-07-30 10:08                   ` Hans Reiser
2001-07-30 19:06                     ` Christoph Hellwig
2001-07-30 20:30                       ` Hans Reiser
2001-07-30 20:49                         ` Christoph Hellwig
2001-07-30 21:05                           ` Hans Reiser
2001-07-30 21:29                             ` Christoph Hellwig
2001-07-30 21:44                               ` Hans Reiser
2001-07-30 21:48                               ` Hans Reiser
2001-07-30 21:57                                 ` Chris Wedgwood
2001-07-30 21:58                                   ` Christoph Hellwig
2001-07-31  7:45                                 ` Henning P. Schmiedehausen
2001-07-31  9:55                                   ` Hans Reiser
2001-07-31 10:24                                     ` Arjan van de Ven
2001-07-31 10:24                                     ` Anders Eriksson
2001-07-31 10:32                                       ` Chris Wedgwood
2001-07-31 17:01                                       ` [OT] " J Sloan
2001-07-30 21:59                             ` Rik van Riel
2001-07-30 22:34                               ` Hans Reiser
2001-07-31 11:34                                 ` David Weinehall
2001-07-31 12:22                                   ` ReiserFS / 2.4.6 / Data Corruption (patch to cause redhat to unmount reiserfs on halt included) Hans Reiser
2001-07-31 12:37                                     ` Christoph Hellwig
2001-07-31 13:12                                       ` Hans Reiser
2001-07-30 22:41                               ` ReiserFS / 2.4.6 / Data Corruption Kip Macy
2001-07-30 22:50                                 ` Christoph Hellwig
2001-07-30 21:13                           ` Hans Reiser
2001-07-30 21:21                           ` Hans Reiser
2001-07-30 21:49                             ` Christoph Hellwig
2001-07-31  2:34                               ` Andrew Morton
2001-07-30 22:04                             ` Rik van Riel
2001-07-30 22:36                               ` Hans Reiser
2001-07-30 22:53                                 ` Rik van Riel
2001-07-30 23:12                                   ` Hans Reiser
2001-07-31 10:32                                 ` Chris Wedgwood
2001-07-31 10:59                                   ` Hans Reiser
2001-07-31 11:42                                     ` Chris Wedgwood
2001-07-31 13:41                                     ` Chris Mason
2001-07-31 15:15                                       ` Chris Wedgwood
2001-07-31 15:58                                         ` Chris Mason
2001-07-31 15:22                                       ` Hans Reiser
2001-07-31 15:49                                         ` Chris Mason
2001-07-31 22:08                               ` Jussi Laako
2001-07-31 22:32                                 ` Dan Hollis
2001-07-31 23:45                                   ` Chris Wedgwood
2001-08-05 22:19                                   ` CRC loop method (was Re: ReiserFS / 2.4.6 / Data Corruption) Pavel Machek
2001-08-01 16:23                                 ` ReiserFS / 2.4.6 / Data Corruption Andreas Dilger
2001-08-02 13:44                         ` Pavel Machek
2001-07-27 15:06             ` Daniel Phillips
2001-07-27 15:33               ` Hans Reiser
2001-07-27 16:30                 ` Daniel Phillips
2001-07-27 16:49                   ` Early Flush Hans Reiser
2001-07-27 15:07             ` ReiserFS / 2.4.6 / Data Corruption Chris Wedgwood
2001-07-27 16:39             ` Andrew Morton [this message]
2001-07-27 16:57               ` Hans Reiser
2001-07-27 17:28                 ` Andrew Morton
2001-07-27 17:45                   ` Hans Reiser
2001-07-27 17:10               ` Steve Lord
2001-07-27 14:48           ` Hans Reiser
2001-07-27 15:04             ` bvermeul
2001-07-27 15:38               ` Hans Reiser
2001-07-27 17:29                 ` Eric W. Biederman
2001-07-27 18:47                   ` bvermeul
2001-07-27 19:22                     ` Hans Reiser
2001-07-28  6:19                       ` bvermeul
2001-07-28  7:39                         ` Hans Reiser
2001-07-27 19:30                     ` Jussi Laako
2001-07-28  6:21                       ` bvermeul
2001-07-27 21:49                     ` Daniel Phillips
2001-07-27 20:49                 ` Lehmann 
2001-07-28 14:13           ` Matthew Gardiner
2001-07-28 14:40             ` bvermeul
2001-07-18  9:42 ` Hans Reiser
     [not found]   ` <3B5579E7.5090107@namesys.com>
2001-07-18 16:26     ` Sam Thompson
2001-07-18 16:34       ` Hans Reiser
2001-07-18 13:09 ` Andre Pang
     [not found] <no.id>
2001-07-27 13:27 ` Alan Cox
2001-07-27 13:38   ` bvermeul
2001-07-27 13:39     ` Alan Cox
2001-07-27 13:47       ` bvermeul
2001-07-27 13:49         ` Alan Cox
2001-07-28 14:16       ` Matthew Gardiner
2001-08-08 18:42       ` Stephen C. Tweedie
2001-07-27 14:16   ` Philip R. Auld
2001-07-27 14:38     ` Jordan
2001-07-27 14:51     ` Hans Reiser
2001-07-27 15:12       ` Philip R. Auld
2001-07-27 14:23   ` Hans Reiser
2001-07-27 14:21 ` Alan Cox
2001-07-28 14:18   ` Matthew Gardiner
2001-07-28 16:25     ` Alan Cox
2001-07-29 10:15       ` Matthew Gardiner
2001-07-29 11:10         ` Chris Wedgwood
2001-07-29 14:28           ` Luigi Genoni
2001-07-29 11:16     ` Christoph Hellwig
2001-07-27 15:06 ` Alan Cox
2001-07-27 15:26   ` Joshua Schmidlkofer
2001-07-27 15:46     ` Hans Reiser
2001-07-27 17:46       ` Christoph Rohland
2001-07-27 18:02         ` Hans Reiser
2001-07-27 18:10       ` Dustin Byford
2001-07-27 19:20         ` Hans Reiser
2001-07-28 16:10       ` Henning P. Schmiedehausen
2001-07-27 15:31   ` Hans Reiser
2001-07-27 16:25     ` Kip Macy
2001-07-27 17:29       ` Ville Herva
2001-07-27 17:40         ` Alan Cox
2001-07-27 17:43           ` Ville Herva
2001-07-27 20:46   ` Lehmann 
2001-07-27 21:13     ` Hans Reiser
2001-07-27 15:51 ` Alan Cox
2001-07-27 16:41   ` Hans Reiser
2001-07-27 16:55 ` Alan Cox
2001-07-27 21:24 ` Alan Cox
2001-07-27 21:47   ` Hans Reiser
2001-07-27 22:10 ` Alan Cox
2001-07-28  7:36   ` Hans Reiser
2001-07-28 14:08     ` Chris Mason
2001-07-27 15:13 Cress, Andrew R
2001-07-30 15:24 Chris Mason
2001-07-30 15:47 ` Andrew Morton
2001-07-30 16:04   ` Chris Mason

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=3B619956.6AA072F9@zip.com.au \
    --to=akpm@zip.com.au \
    --cc=linux-kernel@vger.kernel.org \
    --cc=menion@srci.iwpsd.org \
    --cc=reiser@namesys.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;
as well as URLs for NNTP newsgroup(s).