[sheepdog] [PATCH 2/2] journal: call panic() when the journaling file is broken

Hitoshi Mitake mitake.hitoshi at lab.ntt.co.jp
Fri Oct 18 04:05:44 CEST 2013


This change makes the journaling subsystem more defensive and enhances the error
logging.

Cc: Kees Bos <k.bos at capitar.com>
Signed-off-by: Hitoshi Mitake <mitake.hitoshi at lab.ntt.co.jp>
---
 sheep/journal.c |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/sheep/journal.c b/sheep/journal.c
index 8460452..b5f0ff2 100644
--- a/sheep/journal.c
+++ b/sheep/journal.c
@@ -149,6 +149,10 @@ static int replay_journal_entry(struct journal_descriptor *jd)
 		return 0;
 	}
 
+	if (jd->flag != JF_STORE)
+		panic("flag is not JF_STORE, the journaling file is broken."
+		      " please remove the journaling file and restart sheep daemon");
+
 	sd_info("%s, size %" PRIu64 ", off %" PRIu64 ", %d", path, jd->size,
 		jd->offset, jd->create);
 
-- 
1.7.10.4




More information about the sheepdog mailing list