diff options
author | Sage Weil <sage@inktank.com> | 2013-05-08 17:45:03 -0700 |
---|---|---|
committer | Sage Weil <sage@inktank.com> | 2013-05-08 17:45:03 -0700 |
commit | 5177fcb6bf384d5c9caed9b28f28f656823b3d64 (patch) | |
tree | 29c02be40f337cb416b9b996c97dd6e559e6f515 | |
parent | 83bbae415de16f708ca1cb24861ddbb0bd514a7f (diff) | |
parent | 6c1e4791782ce2b3e101ee80640d896bcda684de (diff) | |
download | ceph-5177fcb6bf384d5c9caed9b28f28f656823b3d64.tar.gz |
Merge remote-tracking branch 'gh/next'
Conflicts:
src/mon/MonitorDBStore.h
-rwxr-xr-x | src/ceph-create-keys | 12 | ||||
-rw-r--r-- | src/common/Preforker.h | 5 | ||||
-rw-r--r-- | src/init-ceph.in | 4 | ||||
-rw-r--r-- | src/osd/OSD.cc | 40 | ||||
-rw-r--r-- | src/osd/PG.cc | 1 | ||||
-rw-r--r-- | src/tools/ceph.cc | 1 |
6 files changed, 41 insertions, 22 deletions
diff --git a/src/ceph-create-keys b/src/ceph-create-keys index bb3967c0879..23632dd2075 100755 --- a/src/ceph-create-keys +++ b/src/ceph-create-keys @@ -34,7 +34,17 @@ def wait_for_quorum(cluster, mon_id): time.sleep(1) continue - data = json.loads(out) + if out == '': + LOG.info('ceph-mon admin socket returned no data') + time.sleep(1) + continue + + try: + data = json.loads(out) + except: + LOG.info('failed to parse json %s', out) + sys.exit(errno.EINVAL) + state = data['state'] if state not in QUORUM_STATES: LOG.info('ceph-mon is not in quorum: %r', state) diff --git a/src/common/Preforker.h b/src/common/Preforker.h index 07f21b45e46..bda5771d37b 100644 --- a/src/common/Preforker.h +++ b/src/common/Preforker.h @@ -6,6 +6,7 @@ #include <sys/types.h> #include <sys/socket.h> #include <sys/wait.h> +#include <errno.h> #include <unistd.h> #include "common/safe_io.h" @@ -78,7 +79,7 @@ public: void exit(int r) { if (forked) { // tell parent - ::write(fd[1], &r, sizeof(r)); + (void)::write(fd[1], &r, sizeof(r)); } ::exit(r); } @@ -86,7 +87,7 @@ public: void daemonize() { assert(forked); static int r = -1; - ::write(fd[1], &r, sizeof(r)); + (void)::write(fd[1], &r, sizeof(r)); } }; diff --git a/src/init-ceph.in b/src/init-ceph.in index 57ae19b11e1..a9ee60b3280 100644 --- a/src/init-ceph.in +++ b/src/init-ceph.in @@ -310,8 +310,8 @@ for name in $what; do # command line, ceph.conf can override what it wants get_conf osd_location "" "osd crush location" get_conf osd_weight "" "osd crush initial weight" - defaultweight=`df /var/lib/ceph/osd/ceph-$id/ | tail -1 | awk '{ d= $2/1073741824 ; r = sprintf("%.2f", d); print r }'` - get_conf osd_keyring "/var/lib/ceph/osd/ceph-$id/keyring" "keyring" + defaultweight=`df $osd_data/. | tail -1 | awk '{ d= $2/1073741824 ; r = sprintf("%.2f", d); print r }'` + get_conf osd_keyring "$osd_data/keyring" "keyring" $BINDIR/ceph \ --name="osd.$id" \ --keyring="$osd_keyring" \ diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index 690bce68787..d27a3b51a3c 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -1775,8 +1775,29 @@ void OSD::load_pgs() dout(10) << "PG " << pg->info.pgid << " must upgrade..." << dendl; pg->upgrade(store, i->second); - } else { - assert(i->second.empty()); + } else if (!i->second.empty()) { + // handle upgrade bug + for (interval_set<snapid_t>::iterator j = i->second.begin(); + j != i->second.end(); + ++j) { + for (snapid_t k = j.get_start(); + k != j.get_start() + j.get_len(); + ++k) { + assert(store->collection_empty(coll_t(pgid, k))); + ObjectStore::Transaction t; + t.remove_collection(coll_t(pgid, k)); + store->apply_transaction(t); + } + } + } + + if (!pg->snap_collections.empty()) { + pg->snap_collections.clear(); + pg->dirty_big_info = true; + pg->dirty_info = true; + ObjectStore::Transaction t; + pg->write_if_dirty(t); + store->apply_transaction(t); } service.init_splits_between(pg->info.pgid, pg->get_osdmap(), osdmap); @@ -4951,21 +4972,6 @@ void OSD::split_pgs( i->m_seed, coll_t::make_temp_coll(*i)); } - for (interval_set<snapid_t>::iterator k = parent->snap_collections.begin(); - k != parent->snap_collections.end(); - ++k) { - for (snapid_t j = k.get_start(); j < k.get_start() + k.get_len(); - ++j) { - rctx->transaction->create_collection( - coll_t(*i, j)); - rctx->transaction->split_collection( - coll_t(parent->info.pgid, j), - split_bits, - i->m_seed, - coll_t(*i, j)); - } - } - child->snap_collections = parent->snap_collections; parent->split_into( *i, child, diff --git a/src/osd/PG.cc b/src/osd/PG.cc index ae88be652da..f4ad633ab13 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -2565,6 +2565,7 @@ void PG::upgrade(ObjectStore *store, const interval_set<snapid_t> &snapcolls) objects.clear(); } ObjectStore::Transaction t; + snap_collections.clear(); dirty_info = true; write_if_dirty(t); int r = store->apply_transaction(t); diff --git a/src/tools/ceph.cc b/src/tools/ceph.cc index ac0553cd825..c28c1b200b3 100644 --- a/src/tools/ceph.cc +++ b/src/tools/ceph.cc @@ -249,6 +249,7 @@ int do_admin_socket(string path, string cmd) } if (r < 4) { cerr << "read only got " << r << " bytes of 4 expected for response length; invalid command?" << std::endl; + r = -1; goto out; } len = ntohl(len); |