global_init: do not count threads before daemonize()

We were verifying that there was only 1 thread (the presumably main()) when
we call daemonize.  However, with the new logging code, we stop a thread
right before the check, and /proc apparently updates asynchronously such
that our attempt to count running threads gives us a bad answer.

Just remove this kludgey check; we'll have to catch this class of bugs
the hard way.

Signed-off-by: Sage Weil <sage.weil@dreamhost.com>
Reviewed-by: Greg Farnum <greg@inktank.com>
mon: move PGMap[::Incremental] to new encode/decode macros

This is a backward-incompatible change; downgrades will no longer be
possible.

Signed-off-by: Sage Weil <sage.weil@dreamhost.com>
keyring: make child of KeyStore

This lets us pass a keyring to the auth methods as a source for keys for
doing the authentication handshaking.  Normally we pass a RotatatingKeyring
or the KeyServer, but for mon->mon we don't use a service key.  This will
let us use a simple KeyRing for that.

Signed-off-by: Sage Weil <sage@newdream.net>
osdmap: filter out nonexistent osds from map

It is possible that the crush map contains device ids that do not exist as
osds.  Filter them out of the CRUSH result.

Signed-off-by: Sage Weil <sage@newdream.net>
cephfs: pass -1 for old preferred_osd field

Signed-off-by: Sage Weil <sage@inktank.com>
mon: fail 'osd crush set ...' is osd doesn't exist

If an osd doesn't exist, don't let users add/update it in the crush map.

Signed-off-by: Sage Weil <sage@inktank.com>
crush: adjust max_devices appropriately in insert_item()

If we insert a new item, make sure max_devices is still the max id + 1.

Signed-off-by: Sage Weil <sage@inktank.com>
crush: pass weight vector size to map function

Pass the size of the weight vector into crush_do_rule() to ensure that we
don't access values past the end.  This can happen if the caller misbehaves
and passes a weight vector that is smaller than max_devices.

Currently the monitor tries to prevent that from happening, but this will
gracefully tolerate previous bad osdmaps that got into this state.  It's
also a bit more defensive.

Signed-off-by: Sage Weil <sage@inktank.com>
Updated link to publications
Merge branch 'wip-osdmap'

Reviewed-by: Greg Farnum <greg@inktank.com>
Documentation theme updates:

1) Background color in navbar
2) Correct body fonts
3) Document pane background (below the content)
mon: keep mon. secret in an external keyring

- Keep the mon. key in a separate keyring files, "keyring", in the mon
  data dir.
- During init, if we don't find that file, copy the key from the keyserver
  database.
- During mkfs, put the mon. key in that file, and remove it from the seed
  file that primes the auth database.

This will allow admins to change the mon. key without bringing the cluster
online and doing something wonky.

Signed-off-by: Sage Weil <sage@newdream.net>
mon: use external keyring for mon->mon auth

- Feed our keyring into the auth methods.
- Do not fail to build a ticket for type MON when we don't have a cap; it
  won't be in the auth database.  Also, we don't have caps on the monitors
  that are enfoced between each other.

Signed-off-by: Sage Weil <sage@newdream.net>
objecter: ping connections with lingering ops every tick()

Also, make sure that we initialize linger_op.session once
we have it.

Signed-off-by: Yehuda Sadeh <yehuda@hq.newdream.net>
Objecter: don't throttle resent linger ops

Throttling is intended to stop the caller from submitting too many
requests, not blocking requests that are being resent internally. This
prevents a deadlock when handling an osdmap - previously
handle_osd_map could block when resending linger ops due to the
throttling. This would stop the messenger's dispatch thread from
delivering any subsequest messages, so the throttle budget would never
be replenished.

Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
Reviewed-by: Sage Weil <sage@inktank.com>
Merge branch 'stable'

Conflicts:
	src/osdc/Objecter.cc
mon: new encoding for MonCaps

Signed-off-by: Sage Weil <sage@inktank.com>
monmap: use feature bits and single encode() method

Instead of selecting an encode method in the caller, use a normal features
argument to encode() and branch there.

Leave behavior of all callers untouched.  We continue to assume, for
example, that all monitors have the same features, and that
'ceph mon getmap' should return the fully-featured encoding.

Signed-off-by: Sage Weil <sage@inktank.com>
mon: conditonally encode monmap for peer mon during probe

This might be sufficient to let monitors with different versions of the
monmap encoding interoperate, but I'm too lazy to fully test it right now.

Signed-off-by: Sage Weil <sage@inktank.com>
monmap: new encoder

Introduce a feature bit so that we can interoperate with older
peers.

Signed-off-by: Sage Weil <sage@inktank.com>