Skip to contentSkip to conversation

dm-raid1: fix data lost on success return at log failure

PATCH New Takahiro Yasui 1 participant 1 message Dec 23, 2009 Device mapper

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dm-raid1: fix data lost on success return at log failure

This patch fix the case that I/Os return "success" (0) even though they have never been attempted on the devices. When the log has failed and the DM_RAID_HANDLE_ERRORS flag is not set, I/Os are put in the failures queue and return "success" (0) in the do_failures() function. This is really *data lost*. When the log has failed, all I/Os should be held in kernel as 2.6.32 kernel does.

---
 drivers/md/dm-raid1.c |   11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)
drivers/md/dm-raid1.c +4 -7
Index: linux-2.6.33-rc1-dm/drivers/md/dm-raid1.c
===================================================================
@@ -724,13 +724,10 @@ static void do_writes(struct mirror_set 
 	/*
 	 * Dispatch io.
 	 */
-	if (unlikely(ms->log_failure)) {
-		spin_lock_irq(&ms->lock);
-		bio_list_merge(&ms->failures, &sync);
-		spin_unlock_irq(&ms->lock);
-		wakeup_mirrord(ms);
-	} else
-		while ((bio = bio_list_pop(&sync)))
+	while ((bio = bio_list_pop(&sync)))
+		if (unlikely(ms->log_failure))
+			hold_bio(ms, bio);
+		else
 			do_write(ms, bio);
 
 	while ((bio = bio_list_pop(&recover)))
Signature · 2 lines
Takahiro Yasui
Hitachi Computer Products (America), Inc.