summaryrefslogtreecommitdiffstats
path: root/sys/contrib
diff options
context:
space:
mode:
authorpjd <pjd@FreeBSD.org>2007-04-14 20:50:14 +0000
committerpjd <pjd@FreeBSD.org>2007-04-14 20:50:14 +0000
commit1c12f58815d47eb92cdd273abf43ea07839ee55d (patch)
treede6554d789aa14cf498b2b0340b346971f3e9431 /sys/contrib
parentdf7c6cd2a9ee0b08881df6dd16377e9cb099c9d5 (diff)
downloadFreeBSD-src-1c12f58815d47eb92cdd273abf43ea07839ee55d.zip
FreeBSD-src-1c12f58815d47eb92cdd273abf43ea07839ee55d.tar.gz
Fix RAID-Z resilvering.
Obtained from: OpenSolaris
Diffstat (limited to 'sys/contrib')
-rw-r--r--sys/contrib/opensolaris/uts/common/fs/zfs/vdev_raidz.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/sys/contrib/opensolaris/uts/common/fs/zfs/vdev_raidz.c b/sys/contrib/opensolaris/uts/common/fs/zfs/vdev_raidz.c
index 08df7e0..0c86630 100644
--- a/sys/contrib/opensolaris/uts/common/fs/zfs/vdev_raidz.c
+++ b/sys/contrib/opensolaris/uts/common/fs/zfs/vdev_raidz.c
@@ -867,8 +867,18 @@ vdev_raidz_io_done(zio_t *zio)
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 @@ vdev_raidz_io_done(zio_t *zio)
* 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 <=
OpenPOWER on IntegriCloud