public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] - filesystem corruption on soft RAID5 in 2.4.0+
@ 2001-01-21 20:47 Neil Brown
  2001-01-21 21:14 ` Manfred Spraul
                   ` (4 more replies)
  0 siblings, 5 replies; 13+ messages in thread
From: Neil Brown @ 2001-01-21 20:47 UTC (permalink / raw)
  To: Otto Meier, Holger Kiehl, Hans Reiser, edward, Ed Tomlinson,
	Nils Rennebarth, Manfred Spraul, David Willmore, Linus Torvalds,
	Alan Cox
  Cc: linux-kernel, linux-raid


There have been assorted reports of filesystem corruption on raid5 in
2.4.0, and I have finally got a patch - see below.
I don't know if it addresses everybody's problems, but it fixed a very
really problem that is very reproducable.

The problem is that parity can be calculated wrongly when doing a
read-modify-write update cycle.  If you have a fully functional, you
wont notice this problem as the parity block is never used to return
data.  But if you have a degraded array, you will get corruption very
quickly.
So I think this will solve the reported corruption with ext2fs, as I
think they were mostly on degradred arrays.  I have no idea whether it
will address the reiserfs problems as I don't think anybody reporting
those problems described their array.

In any case, please apply, and let me know of any further problems.


--- ./drivers/md/raid5.c	2001/01/21 04:01:57	1.1
+++ ./drivers/md/raid5.c	2001/01/21 20:36:05	1.2
@@ -714,6 +714,11 @@
 		break;
 	}
 	spin_unlock_irq(&conf->device_lock);
+	if (count>1) {
+		xor_block(count, bh_ptr);
+		count = 1;
+	}
+	
 	for (i = disks; i--;)
 		if (chosen[i]) {
 			struct buffer_head *bh = sh->bh_cache[i];


 From my notes for this patch:

   For the read-modify-write cycle, we need to calculate the xor of a
   bunch of old blocks and bunch of new versions of those blocks.  The
   old and new blocks occupy the same buffer space, and because xoring
   is delayed until we have lots of buffers, it could get delayed too
   much and parity doesn't get calculated until after data had been
   over-written.

   This patch flushes any pending xor's before copying over old buffers.


Everybody running raid5 on 2.4.0 or 2.4.1-pre really should apply this
patch, and then arrange the get parity checked and corrected on their
array.
There currently isn't a clean way to correct parity.
One way would be to shut down to single user, remount all filesystems
readonly, or un mount them, and the pull the plug.
On reboot, raid will rebuild parity, but the filesystems should be
clean.
An alternate it so rerun mkraid giving exactly the write configuration.
This doesn't require pulling the plug, but if you get the config file
wrong, you could loose your data.

NeilBrown
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 13+ messages in thread
* Re: [PATCH] - filesystem corruption on soft RAID5 in 2.4.0+
@ 2001-01-22  0:18 Bernd Eckenfels
  2001-01-22  6:37 ` Neil Brown
  0 siblings, 1 reply; 13+ messages in thread
From: Bernd Eckenfels @ 2001-01-22  0:18 UTC (permalink / raw)
  To: linux-kernel

In article <14955.19182.663691.194031@notabene.cse.unsw.edu.au> you wrote:
> There have been assorted reports of filesystem corruption on raid5 in
> 2.4.0, and I have finally got a patch - see below.
> I don't know if it addresses everybody's problems, but it fixed a very
> really problem that is very reproducable.

Do you know if it is safe with 2.4.0 kernels to swap on degraded soft raids?
On the debian-devel list there is a discussion. Currently Debisn Systems to
not do swap-on on boot if a raid partition is resyncing.

Greetings
Bernd
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 13+ messages in thread
* Re: [PATCH] - filesystem corruption on soft RAID5 in 2.4.0+
@ 2001-01-22 18:09 Otto Meier
  0 siblings, 0 replies; 13+ messages in thread
From: Otto Meier @ 2001-01-22 18:09 UTC (permalink / raw)
  To: linux-raid@vger.kernel.org, linux-kernel@vger.kernel.org

With this patch I did rebuilt my raid5 from scratch. So far it still runs in degraded mode
to honor the father of invention. 
System is a SMP Dual Celeron with kernel 2.4.0. I copied 18 Gbyte of data from my 
backup  to it. So far i have not seen any corroption messages. 
Last time I did that I got a lot of them. Seams that the fix has improved things for me.
 
Otto

On Mon, 22 Jan 2001 07:47:42 +1100 (EST), Neil Brown wrote:

>
>There have been assorted reports of filesystem corruption on raid5 in
>2.4.0, and I have finally got a patch - see below.
>I don't know if it addresses everybody's problems, but it fixed a very
>really problem that is very reproducable.
>
>The problem is that parity can be calculated wrongly when doing a
>read-modify-write update cycle.  If you have a fully functional, you
>wont notice this problem as the parity block is never used to return
>data.  But if you have a degraded array, you will get corruption very
>quickly.
>So I think this will solve the reported corruption with ext2fs, as I
>think they were mostly on degradred arrays.  I have no idea whether it
>will address the reiserfs problems as I don't think anybody reporting
>those problems described their array.
>
>In any case, please apply, and let me know of any further problems.
>
>
>--- ./drivers/md/raid5.c	2001/01/21 04:01:57	1.1
>+++ ./drivers/md/raid5.c	2001/01/21 20:36:05	1.2
>@@ -714,6 +714,11 @@
> 		break;
> 	}
> 	spin_unlock_irq(&conf->device_lock);
>+	if (count>1) {
>+		xor_block(count, bh_ptr);
>+		count = 1;
>+	}
>+	
> 	for (i = disks; i--;)
> 		if (chosen[i]) {
> 			struct buffer_head *bh = sh->bh_cache[i];
>
>
> From my notes for this patch:
>
>   For the read-modify-write cycle, we need to calculate the xor of a
>   bunch of old blocks and bunch of new versions of those blocks.  The
>   old and new blocks occupy the same buffer space, and because xoring
>   is delayed until we have lots of buffers, it could get delayed too
>   much and parity doesn't get calculated until after data had been
>   over-written.
>
>   This patch flushes any pending xor's before copying over old buffers.
>
>
>Everybody running raid5 on 2.4.0 or 2.4.1-pre really should apply this
>patch, and then arrange the get parity checked and corrected on their
>array.
>There currently isn't a clean way to correct parity.
>One way would be to shut down to single user, remount all filesystems
>readonly, or un mount them, and the pull the plug.
>On reboot, raid will rebuild parity, but the filesystems should be
>clean.
>An alternate it so rerun mkraid giving exactly the write configuration.
>This doesn't require pulling the plug, but if you get the config file
>wrong, you could loose your data.
>
>NeilBrown
>






-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2001-03-09  1:28 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-01-21 20:47 [PATCH] - filesystem corruption on soft RAID5 in 2.4.0+ Neil Brown
2001-01-21 21:14 ` Manfred Spraul
2001-01-22 11:19   ` Holger Kiehl
2001-01-22  9:23 ` Hans Reiser
2001-01-22 19:36 ` Edward
2001-01-23  8:21 ` Holger Kiehl
2001-03-07 21:30 ` Kernel crash during resync of raid5 on SMP Otto Meier
2001-03-07 21:55   ` Neil Brown
2001-03-08 15:19     ` Otto Meier
2001-03-09  0:17       ` Neil Brown
  -- strict thread matches above, loose matches on Subject: below --
2001-01-22  0:18 [PATCH] - filesystem corruption on soft RAID5 in 2.4.0+ Bernd Eckenfels
2001-01-22  6:37 ` Neil Brown
2001-01-22 18:09 Otto Meier

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox