summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSage Weil <sage.weil@dreamhost.com>2011-09-01 09:03:39 -0700
committerSage Weil <sage.weil@dreamhost.com>2011-09-01 11:01:01 -0700
commitb71f3bc756ca156db6d624802980700b8a1ea840 (patch)
treed82d2808b097c6eb74bdcd4af6fee951b3e24704
parenta8ab69ab2084daabfac07c637d3fa19576da8ae0 (diff)
downloadceph-b71f3bc756ca156db6d624802980700b8a1ea840.tar.gz
mon: fix 'osd create ...' error paths
Signed-off-by: Sage Weil <sage.weil@dreamhost.com>
-rw-r--r--src/mon/OSDMonitor.cc15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/mon/OSDMonitor.cc b/src/mon/OSDMonitor.cc
index 6db2324eebd..abb878dea9d 100644
--- a/src/mon/OSDMonitor.cc
+++ b/src/mon/OSDMonitor.cc
@@ -1664,16 +1664,21 @@ bool OSDMonitor::prepare_command(MMonCommand *m)
i = atoi(m->cmd[2].c_str());
if (i < 0 || i >= osdmap.get_max_osd()) {
ss << i << " is not a valid osd id";
- getline(ss, rs);
- return -ERANGE;
+ err = -ERANGE;
+ goto out;
+ }
+ if (osdmap.exists(i)) {
+ ss << i << " already exists";
+ err = -EEXIST;
+ goto out;
}
- if (osdmap.exists(i) ||
- pending_inc.new_up_client.count(i) ||
+ if (pending_inc.new_up_client.count(i) ||
(pending_inc.new_state.count(i) &&
(pending_inc.new_state[i] & CEPH_OSD_EXISTS))) {
ss << i << " already exists";
getline(ss, rs);
- return -EEXIST;
+ paxos->wait_for_commit(new Monitor::C_Command(mon, m, -EEXIST, rs, paxos->get_version()));
+ return true;
}
} else {
// allocate a new id