[sheepdog] [PATCH v2 1/3] journal: ignore invalid journal files

Hitoshi Mitake mitake.hitoshi at lab.ntt.co.jp
Wed Apr 10 10:25:10 CEST 2013


From: Hitoshi Mitake <mitake.hitoshi at gmail.com>

Even if journal files are broken, we can do nothing for recoverying
it. It is better to inform it as log messages and continue the
initialization process.

Signed-off-by: Hitoshi Mitake <mitake.hitoshi at lab.ntt.co.jp>
---

v2: panic when do_recover() fails

 sheep/journal.c |   16 +++++++---------
 1 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/sheep/journal.c b/sheep/journal.c
index 2e1d21f..59608ac 100644
--- a/sheep/journal.c
+++ b/sheep/journal.c
@@ -245,31 +245,29 @@ skip:
  * we actually only recover one jfile, the other would be empty. This process
  * is fast with buffered IO that only take several secends at most.
  */
-static int check_recover_journal_file(const char *p)
+static void check_recover_journal_file(const char *p)
 {
 	int old = 0, new = 0;
 
 	if (get_old_new_jfile(p, &old, &new) < 0)
-		return -1;
+		return;
 
 	/* No journal file found */
 	if (old == 0)
-		return 0;
+		return;
 
 	if (do_recover(old) < 0)
-		return -1;
+		panic("recoverying from journal file (old) failed");
 	if (do_recover(new) < 0)
-		return -1;
-
-	return 0;
+		panic("recoverying from journal file (new) failed");
 }
 
 int journal_file_init(const char *path, size_t size, bool skip)
 {
 	int fd;
 
-	if (!skip && check_recover_journal_file(path) < 0)
-		return -1;
+	if (!skip)
+		check_recover_journal_file(path);
 
 	jfile_size = (size * 1024 * 1024) / 2;
 
-- 
1.7.2.5




More information about the sheepdog mailing list