From: Jonathan Brassow <[email-masked]>

kcopyd should accumulate errors - otherwise I/O failures may
be ignored unintentionally.

And invert 'success' (used in a future patch), using a more
intuitive !(read_err || write_err).

Signed-off-by: Jonathan Brassow <[email-masked]>
Signed-off-by: Alasdair G Kergon <[email-masked]>

Index: linux-2.6.17/drivers/md/kcopyd.c
===================================================================
--- linux-2.6.17.orig/drivers/md/kcopyd.c	2006-06-21 16:19:34.000000000 +0100
+++ linux-2.6.17/drivers/md/kcopyd.c	2006-06-21 17:17:57.000000000 +0100
@@ -314,7 +314,7 @@ static void complete_io(unsigned long er
 
 	if (error) {
 		if (job->rw == WRITE)
-			job->write_err &= error;
+			job->write_err |= error;
 		else
 			job->read_err = 1;
 
@@ -460,7 +460,7 @@ static void segment_complete(int read_er
 		job->read_err = 1;
 
 	if (write_err)
-		job->write_err &= write_err;
+		job->write_err |= write_err;
 
 	/*
 	 * Only dispatch more work if there hasn't been an error.
Index: linux-2.6.17/drivers/md/dm-raid1.c
===================================================================
--- linux-2.6.17.orig/drivers/md/dm-raid1.c	2006-06-21 17:17:49.000000000 +0100
+++ linux-2.6.17/drivers/md/dm-raid1.c	2006-06-21 17:17:57.000000000 +0100
@@ -604,7 +604,7 @@ static void recovery_complete(int read_e
 	struct region *reg = (struct region *) context;
 
 	/* FIXME: better error handling */
-	rh_recovery_end(reg, read_err || write_err);
+	rh_recovery_end(reg, !(read_err || write_err));
 }
 
 static int recover(struct mirror_set *ms, struct region *reg)