mirror of
https://github.com/ceph/ceph
synced 2024-12-18 09:25:49 +00:00
osdc/ObjectCacher: refresh iterator in read apply loop
The p iterator points to the next bh, but try_merge_bh() at the end of the loop might merge that into our result and invalidate the iterator. Fix this by repeating the lookup on each pass through the loop. Signed-off-by: Sage Weil <sage@inktank.com>
This commit is contained in:
parent
e287296584
commit
f3db940f05
@ -564,10 +564,13 @@ void ObjectCacher::bh_read_finish(int64_t poolid, sobject_t oid, loff_t start,
|
||||
|
||||
// apply to bh's!
|
||||
loff_t opos = start;
|
||||
map<loff_t, BufferHead*>::iterator p = ob->data.lower_bound(opos);
|
||||
|
||||
while (p != ob->data.end() &&
|
||||
opos < start+(loff_t)length) {
|
||||
while (true) {
|
||||
map<loff_t, BufferHead*>::iterator p = ob->data.lower_bound(opos);
|
||||
if (p == ob->data.end())
|
||||
break;
|
||||
if (opos >= start+(loff_t)length)
|
||||
break;
|
||||
|
||||
BufferHead *bh = p->second;
|
||||
|
||||
if (bh->start() > opos) {
|
||||
|
Loading…
Reference in New Issue
Block a user