diff options
author | Sage Weil <sage@inktank.com> | 2013-05-29 16:50:04 -0700 |
---|---|---|
committer | Sage Weil <sage@inktank.com> | 2013-05-29 16:53:28 -0700 |
commit | d86b9a852b57553448709c2b978ac3a8637cd63f (patch) | |
tree | 79cc3d46fdd680f4387fd1d873a41aec68b5a3f5 | |
parent | fca54bfbb35f0c200fac52963cd2d1780467f59a (diff) | |
download | ceph-d86b9a852b57553448709c2b978ac3a8637cd63f.tar.gz |
osd: initialize new_state field when we use it
If we use operator[] on a new int field its value is undefined; avoid
reading it or using |= et al until we initialize it.
Fixes: #4967
Backport: cuttlefish, bobtail
Signed-off-by: Sage Weil <sage@inktank.com>
Reviewed-by: David Zafman <david.zafman@inktank.com>
(cherry picked from commit 50ac8917f175d1b107c18ecb025af1a7b103d634)
-rw-r--r-- | src/mon/OSDMonitor.cc | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/mon/OSDMonitor.cc b/src/mon/OSDMonitor.cc index 3e6b01831fd..014768f9a5d 100644 --- a/src/mon/OSDMonitor.cc +++ b/src/mon/OSDMonitor.cc @@ -762,7 +762,8 @@ bool OSDMonitor::check_failure(utime_t now, int target_osd, failure_info_t& fi) << dendl; // already pending failure? - if (pending_inc.new_state[target_osd] & CEPH_OSD_UP) { + if (pending_inc.new_state.count(target_osd) && + pending_inc.new_state[target_osd] & CEPH_OSD_UP) { dout(10) << " already pending failure" << dendl; return true; } @@ -2593,6 +2594,8 @@ bool OSDMonitor::prepare_command(MMonCommand *m) done: dout(10) << " creating osd." << i << dendl; + if (pending_inc.new_state.count(i) == 0) + pending_inc.new_state[i] = 0; pending_inc.new_state[i] |= CEPH_OSD_EXISTS | CEPH_OSD_NEW; if (!uuid.is_zero()) pending_inc.new_uuid[i] = uuid; |