From: Greg Farnum Date: Tue, 28 Jun 2011 19:36:00 +0000 (-0700) Subject: Journaler: pay attention to return codes from read head. X-Git-Tag: v0.31~51^2~5 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=2c70bb8f7f285e50d73075d6edf7997f55ec7ee7;p=ceph.git Journaler: pay attention to return codes from read head. Previously we ignored them, except for printing them out. This could lead to bad things like creating new journals for non-existent MDSes if you entered an invalid rank during --reset-journal. Also assert that the stripe unit is valid before using it as a divisor. Signed-off-by: Greg Farnum --- diff --git a/src/osdc/Journaler.cc b/src/osdc/Journaler.cc index a53290b2b692..43eca74aa0dd 100644 --- a/src/osdc/Journaler.cc +++ b/src/osdc/Journaler.cc @@ -188,6 +188,15 @@ void Journaler::_finish_read_head(int r, bufferlist& bl) { assert(state == STATE_READHEAD); + if (r!=0) { + ldout(cct, 0) << "error getting journal off disk" + << dendl; + list ls; + ls.swap(waitfor_recover); + finish_contexts(cct, ls, r); + return; + } + if (bl.length() == 0) { ldout(cct, 1) << "_finish_read_head r=" << r << " read 0 bytes, assuming empty log" << dendl; state = STATE_ACTIVE; @@ -449,6 +458,7 @@ uint64_t Journaler::append_entry(bufferlist& bl) // flush previous object? uint64_t su = get_layout_period(); + assert(su > 0); uint64_t write_off = write_pos % su; uint64_t write_obj = write_pos / su; uint64_t flush_obj = flush_pos / su;