From ff2c2e31973dabeb210358b6c9b44d7d76c661c8 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Fri, 1 Apr 2011 14:01:40 -0700 Subject: [PATCH] journaler: fix requested_pos badness in _issue_read We want to advance requested_pos *only* as far as we actually want to read, i.e., the previously-probed end of the journal. This, among other things, will screw us up later when we reprobe and try to read more because requested_pos is already past read_pos. Signed-off-by: Sage Weil --- src/osdc/Journaler.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/osdc/Journaler.cc b/src/osdc/Journaler.cc index bcf43f2d35089..da458b83d8859 100644 --- a/src/osdc/Journaler.cc +++ b/src/osdc/Journaler.cc @@ -238,6 +238,9 @@ void Journaler::reprobe(Context *finish) void Journaler::_finish_reprobe(int r, uint64_t new_end, Context *onfinish) { assert(new_end >= write_pos); assert(r >= 0); + dout(1) << "_finish_reprobe new_end = " << new_end + << " (header had " << write_pos << ")." + << dendl; write_pos = flush_pos = safe_pos = new_end; state = STATE_ACTIVE; onfinish->finish(r); @@ -676,6 +679,8 @@ void Journaler::_issue_read(int64_t len) uint64_t e = requested_pos + period; e -= e % period; uint64_t l = e - requested_pos; + if (l > len) + l = len; C_Read *c = new C_Read(this, requested_pos); filer.read(ino, &layout, CEPH_NOSNAP, requested_pos, l, &c->bl, 0, c); requested_pos += l; -- 2.39.5