From: Jonathan E Brassow <[email-masked]>

This patch reports the status of the log device so that userspace
can detect the error and take appropriate action.

Signed-off-by: Jonathan E Brassow <[email-masked]>

Index: linux-2.6.19-rc6/drivers/md/dm-log.c
===================================================================
--- linux-2.6.19-rc6.orig/drivers/md/dm-log.c	2006-11-23 22:18:54.000000000 +0000
+++ linux-2.6.19-rc6/drivers/md/dm-log.c	2006-11-23 22:18:55.000000000 +0000
@@ -615,6 +615,7 @@ static int core_status(struct dirty_log 
 
 	switch(status) {
 	case STATUSTYPE_INFO:
+		DMEMIT("1 core");
 		break;
 
 	case STATUSTYPE_TABLE:
@@ -635,6 +636,8 @@ static int disk_status(struct dirty_log 
 
 	switch(status) {
 	case STATUSTYPE_INFO:
+		DMEMIT("3 disk %s %c", lc->log_dev->name,
+		       lc->log_dev_failed ? 'D' : 'A');
 		break;
 
 	case STATUSTYPE_TABLE:
Index: linux-2.6.19-rc6/drivers/md/dm-raid1.c
===================================================================
--- linux-2.6.19-rc6.orig/drivers/md/dm-raid1.c	2006-11-23 22:18:52.000000000 +0000
+++ linux-2.6.19-rc6/drivers/md/dm-raid1.c	2006-11-23 22:18:55.000000000 +0000
@@ -1222,11 +1222,9 @@ static void mirror_resume(struct dm_targ
 static int mirror_status(struct dm_target *ti, status_type_t type,
 			 char *result, unsigned int maxlen)
 {
-	unsigned int m, sz;
+	unsigned int m, sz = 0;
 	struct mirror_set *ms = (struct mirror_set *) ti->private;
 
-	sz = ms->rh.log->type->status(ms->rh.log, type, result, maxlen);
-
 	switch (type) {
 	case STATUSTYPE_INFO:
 		DMEMIT("%d ", ms->nr_mirrors);
@@ -1240,6 +1238,7 @@ static int mirror_status(struct dm_targe
 		break;
 
 	case STATUSTYPE_TABLE:
+		sz = ms->rh.log->type->status(ms->rh.log, type, result, maxlen);
 		DMEMIT("%d", ms->nr_mirrors);
 		for (m = 0; m < ms->nr_mirrors; m++)
 			DMEMIT(" %s %llu", ms->mirror[m].dev->name,