summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSage Weil <sage.weil@dreamhost.com>2011-04-01 14:01:40 -0700
committerSage Weil <sage.weil@dreamhost.com>2011-04-01 14:01:40 -0700
commitff2c2e31973dabeb210358b6c9b44d7d76c661c8 (patch)
tree78bc5e88b986a30d0b2f9e5fda7c0caed5bf8681
parent0fb02b25daa04d590ad9d5bbc42525a1d5d35aed (diff)
downloadceph-ff2c2e31973dabeb210358b6c9b44d7d76c661c8.tar.gz
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 <sage.weil@dreamhost.com>
-rw-r--r--src/osdc/Journaler.cc5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/osdc/Journaler.cc b/src/osdc/Journaler.cc
index bcf43f2d350..da458b83d88 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;