From: Jason Dillaman Date: Wed, 4 May 2016 04:12:05 +0000 (-0400) Subject: librbd: readahead should not read past end of image X-Git-Tag: v11.0.0~602^2~4 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=adb14303ccf8a26ed5536bb692ae63d92ac40a9f;p=ceph.git librbd: readahead should not read past end of image Signed-off-by: Jason Dillaman --- diff --git a/src/common/Readahead.cc b/src/common/Readahead.cc index 55f74db8c06b..34f37dad8144 100644 --- a/src/common/Readahead.cc +++ b/src/common/Readahead.cc @@ -29,7 +29,7 @@ Readahead::extent_t Readahead::update(const vector& extents, uint64_t for (vector::const_iterator p = extents.begin(); p != extents.end(); ++p) { _observe_read(p->first, p->second); } - if (m_readahead_pos >= limit) { + if (m_readahead_pos >= limit|| m_last_pos >= limit) { m_lock.Unlock(); return extent_t(0, 0); } @@ -41,7 +41,7 @@ Readahead::extent_t Readahead::update(const vector& extents, uint64_t Readahead::extent_t Readahead::update(uint64_t offset, uint64_t length, uint64_t limit) { m_lock.Lock(); _observe_read(offset, length); - if (m_readahead_pos >= limit) { + if (m_readahead_pos >= limit || m_last_pos >= limit) { m_lock.Unlock(); return extent_t(0, 0); }