Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix OSD SEGV in heartbeat() #2198

Merged
merged 2 commits into from Aug 4, 2014
Merged

fix OSD SEGV in heartbeat() #2198

merged 2 commits into from Aug 4, 2014

Conversation

liewegas
Copy link
Member

@liewegas liewegas commented Aug 4, 2014

No description provided.

The dout_prefix for OSDService uses get_osdmap() to grab a shared_ptr for
the epoch printout.  The OSD one does not, and is not safe to run in all
thread contexts.

In particular, update_osd_stat() is run by the heartbeat thread and can
race with the shared_ptr itself being updated with a new map.

Ironically, if this were simply an OSDMap*, there would be no race since
the pointer is a single word and updates atomically.

Fix this, and any similar issues, by moving the OSDService methods up in
OSD.cc so that they use the safe dout macro.

Fixes: #8998
Backport: firefly (in a minimal form, I think!)
Signed-off-by: Sage Weil <sage@redhat.com>
Use a get_osdmap_epoch() helper that is a bit lighter weight (by avoiding
copying around an OSDMapRef).

Signed-off-by: Sage Weil <sage@redhat.com>
athanatos pushed a commit that referenced this pull request Aug 4, 2014
fix OSD SEGV in heartbeat()

Reviewed-by: Samuel Just <sam.just@inktank.com>
@athanatos athanatos merged commit dceab8d into next Aug 4, 2014
@athanatos athanatos deleted the wip-8998 branch August 4, 2014 22:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants