]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commit
crimson/osd: erase an element by iterator instead
authorKefu Chai <kchai@redhat.com>
Wed, 29 Jul 2020 06:37:57 +0000 (14:37 +0800)
committerKefu Chai <kchai@redhat.com>
Wed, 29 Jul 2020 07:34:13 +0000 (15:34 +0800)
commit815490bb2c6937e1ee0e76fa2592bb1a747e60bb
treeebcb52addd302a25abd7dd352eb0f6c7bf68b1bd
parent6ad3d0d63e728487bc6f1f7bc041ec5f5aebec1f
crimson/osd: erase an element by iterator instead

we should not remove an element while iterating it in a map, as erasing
the element invalidates the iterator, which causes segmfault when we are
advancing it after erasing the dereferenced element.

in this change, an iterator is used for walking through the map, in
comparision with creating a to-be-removed list, this one is more
efficient and more idiomatic.

Signed-off-by: Kefu Chai <kchai@redhat.com>
src/crimson/osd/heartbeat.cc
src/crimson/osd/heartbeat.h