]> err.no Git - linux-2.6/commitdiff
dm log: fix resume failed log device
authorJonathan Brassow <jbrassow@redhat.com>
Wed, 9 May 2007 09:33:08 +0000 (02:33 -0700)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Wed, 9 May 2007 19:30:48 +0000 (12:30 -0700)
This patch removes the possibility of having uninitialized log state if the
log device has failed.

When a mirror resumes operation, it calls 'resume' on the logging module.  If
disk based logging is being used, the log device is read to fill in the log
state.  If the log device has failed, we cannot simply return, because this
would leave the in-memory log state uninitialized.  Instead, we assume all
regions are out-of-sync and reset the log state.  Failure to do this could
result in the logging code reporting a region as in-sync, even though it
isn't; which could result in a corrupted mirror.

Signed-off-by: Jonathan Brassow <jbrassow@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/md/dm-log.c

index a60acf8d385a3541123ff514e9c7902aa2456ce2..a66428d860fef830d3fddc6d8f48140d7a646a4b 100644 (file)
@@ -478,7 +478,14 @@ static int disk_resume(struct dirty_log *log)
                DMWARN("%s: Failed to read header on mirror log device",
                       lc->log_dev->name);
                fail_log_device(lc);
-               return r;
+               /*
+                * If the log device cannot be read, we must assume
+                * all regions are out-of-sync.  If we simply return
+                * here, the state will be uninitialized and could
+                * lead us to return 'in-sync' status for regions
+                * that are actually 'out-of-sync'.
+                */
+               lc->header.nr_regions = 0;
        }
 
        /* set or clear any new bits -- device has grown */