[dm-devel] [PATCH 2/2] dm-raid1: [PATCH RFC] dm-raid1: keep writing after leg failure -> fix error end io logic if 'keep_log' set for on log failure; add ctr/... comments

heinzm at redhat.com heinzm at redhat.com
Wed Apr 8 12:27:34 UTC 2015


From: Heinz Mauelshagen <heinzm at redhat.com>


The error endio log path seems wrong, because
the patch fails the io in case "keep_log" is set and
the log is _not_ errored.

It should be failed (as the comment explains), when
"keep_log" is set and the log has failed.


Signed-off-by: Heinz Mauelshagen <heinzm at redhat.com>

---
 drivers/md/dm-raid1.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/md/dm-raid1.c b/drivers/md/dm-raid1.c
index ef5f20c..cbf3527 100644
--- a/drivers/md/dm-raid1.c
+++ b/drivers/md/dm-raid1.c
@@ -813,9 +813,11 @@ static void do_failures(struct mirror_set *ms, struct bio_list *failures)
 		 */
 
 		/*
-		 * we return EIO when the log device is failed if keep_log is set
+		 * We return EIO when there's no valid mirror legs
+		 * -or-
+		 * the log device is failed if keep_log is set
 		 */
-		if (!get_valid_mirror(ms) || (keep_log(ms) && !ms->log_failure))
+		if (unlikely(!get_valid_mirror(ms) || (keep_log(ms) && ms->log_failure)))
 			bio_endio(bio, -EIO);
 		/*
 		 * After the userspace get noticed that the leg has failed,
@@ -1048,7 +1050,7 @@ static int parse_features(struct mirror_set *ms, unsigned argc, char **argv,
  * log_type is "core" or "disk"
  * #log_params is between 1 and 3
  *
- * If present, features must be "handle_errors".
+ * If present, features must be "handle_errors" and/or "keep_log".
  */
 static int mirror_ctr(struct dm_target *ti, unsigned int argc, char **argv)
 {
@@ -1417,7 +1419,6 @@ static void mirror_status(struct dm_target *ti, status_type_t type,
 			DMEMIT(" 2 handle_errors keep_log");
 		else if (errors_handled(ms))
 			DMEMIT(" 1 handle_errors");
-
 	}
 }
 
-- 
2.1.0




More information about the dm-devel mailing list