changeset 4034:b20b176bd1e8

6545015 RAID-Z resilver broken
author ahl
date Sat, 14 Apr 2007 11:11:14 -0700
parents ce32e5a0eea0
children 4874e0752050
files usr/src/uts/common/fs/zfs/vdev_raidz.c
diffstat 1 files changed, 16 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/uts/common/fs/zfs/vdev_raidz.c	Sat Apr 14 05:49:17 2007 -0700
+++ b/usr/src/uts/common/fs/zfs/vdev_raidz.c	Sat Apr 14 11:11:14 2007 -0700
@@ -867,8 +867,18 @@
 		case 0:
 			if (zio_checksum_error(zio) == 0) {
 				zio->io_error = 0;
+
+				/*
+				 * If we read parity information (unnecessarily
+				 * as it happens since no reconstruction was
+				 * needed) regenerate and verify the parity.
+				 * We also regenerate parity when resilvering
+				 * so we can write it out to the failed device
+				 * later.
+				 */
 				if (parity_errors + parity_untried <
-				    rm->rm_firstdatacol) {
+				    rm->rm_firstdatacol ||
+				    (zio->io_flags & ZIO_FLAG_RESILVER)) {
 					n = raidz_parity_verify(zio, rm);
 					unexpected_errors += n;
 					ASSERT(parity_errors + n <=
@@ -925,8 +935,12 @@
 				 * perform the reconstruction, but this should
 				 * be a relatively uncommon case, and can be
 				 * optimized if it becomes a problem.
+				 * We also regenerate parity when resilvering
+				 * so we can write it out to the failed device
+				 * later.
 				 */
-				if (parity_errors < rm->rm_firstdatacol - 1) {
+				if (parity_errors < rm->rm_firstdatacol - 1 ||
+				    (zio->io_flags & ZIO_FLAG_RESILVER)) {
 					n = raidz_parity_verify(zio, rm);
 					unexpected_errors += n;
 					ASSERT(parity_errors + n <=