]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commit
ObjectCacher: fix off-by-one error in split
authorJosh Durgin <josh.durgin@inktank.com>
Fri, 16 Nov 2012 00:20:33 +0000 (16:20 -0800)
committerSage Weil <sage@inktank.com>
Fri, 4 Jan 2013 20:32:36 +0000 (12:32 -0800)
commitcd5f2bfdbb7fbf9237bef482845644cc41fa66de
tree70ef85368a2b24b9dc8bd1f81c2e38678281e768
parent802c486fd0913e9fe58ae7ff72df135f99712358
ObjectCacher: fix off-by-one error in split

This error left a completion that should have been attached
to the right BufferHead on the left BufferHead, which would
result in the completion never being called unless the buffers
were merged before it's original read completed. This would cause
a hang in any higher level waiting for a read to complete.

The existing loop went backwards (using a forward iterator),
but stopped when the iterator reached the beginning of the map,
or when a waiter belonged to the left BufferHead.

If the first list of waiters should have been moved to the right
BufferHead, it was skipped because at that point the iterator
was at the beginning of the map, which was the main condition
of the loop.

Restructure the waiters-moving loop to go forward in the map instead,
so it's harder to make an off-by-one error.

Possibly-fixes: #3286
Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
(cherry picked from commit 2e862f4d183d8b57b43b0777737886f18f68bf00)
src/osdc/ObjectCacher.cc