Skip to contentSkip to conversation

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

PATCH New [email protected] 1 participant 1 message Apr 8, 2015 Device mapper

lore
Share & tools
lore
#0 lore raw

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

From: Heinz Mauelshagen <[email protected]>

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.

---
 drivers/md/dm-raid1.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/md/dm-raid1.c +5 -4
index ef5f20c..cbf3527 100644
@@ -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");
-
 	}
 }
 
Signature · 1 line
2.1.0