[sheepdog] [PATCH] sheep: read journal head first in journal_recover
levin li
levin108 at gmail.com
Thu Jul 5 08:06:10 CEST 2012
From: levin li <xingke.lwp at taobao.com>
Sheep doesn't read the journal head in journal_recover which
always leaves all the fields of journal head uninitialized,
so the target_path is something random.
Signed-off-by: levin li <xingke.lwp at taobao.com>
---
sheep/journal.c | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/sheep/journal.c b/sheep/journal.c
index d082aa2..74384b2 100644
--- a/sheep/journal.c
+++ b/sheep/journal.c
@@ -257,6 +257,12 @@ int jrnl_recover(const char *jrnl_dir)
goto end_while_3;
}
+ ret = pread64(jd.fd, &jd.head, sizeof(jd.head), 0);
+ if (ret != sizeof(jd.head)) {
+ eprintf("can't read journal head\n");
+ goto end_while_2;
+ }
+
ret = pread64(jd.fd, &end_mark, sizeof(end_mark),
sizeof(jd.head) + jd.head.size);
if (ret != sizeof(end_mark)) {
--
1.7.1
More information about the sheepdog
mailing list