[dm-devel] [PATCH][BUGFIX] dm-raid1: fix data lost on success return at log failure

Takahiro Yasui tyasui at redhat.com
Wed Dec 23 22:18:41 UTC 2009


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.


Signed-off-by: Takahiro Yasui <tyasui at redhat.com>
---
 drivers/md/dm-raid1.c |   11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

Index: linux-2.6.33-rc1-dm/drivers/md/dm-raid1.c
===================================================================
--- linux-2.6.33-rc1-dm.orig/drivers/md/dm-raid1.c
+++ 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)))

-- 
Takahiro Yasui
Hitachi Computer Products (America), Inc.




More information about the dm-devel mailing list