mon: create fail_mds_gid() helper; make 'ceph mds rm ...' more generic

Take a gid or a rank or a name.  Use a nicer helper.

Signed-off-by: Sage Weil <sage@inktank.com>
mon: enforce unique name in mdsmap

Add 'mds enforce unique name' option, defaulting to true.

If set, when an MDS boots, it will kick any previous mds with the same
name from the mdsmap.  This is possibly less confusing for users.  If
an mds daemon restarts, it will immediately replace its previous
instantiation.

Two misconfigured daemons running with the same name will fight over
the same role.

Fixes: #3857
Signed-off-by: Sage Weil <sage@inktank.com>
mds: gracefully exit if newer gid replaces us by name

If 'mds enforce unique name' is set, and another MDS with the same name
kicks us out of the MDSMap, gracefully exit instead of respawning and
fighting over our position.

Signed-off-by: Sage Weil <sage@inktank.com>
mds: open mydir after replay

In certain cases, we may replay the journal and not end up with the
dirfrag for mydir open.  This is fine--we just need to open it up and
fetch it below.

Signed-off-by: Sage Weil <sage@inktank.com>
osd: remove DecayCounter header

Neither the OSD nor the PG makes any use of this.

Signed-off-by: Greg Farnum <greg@inktank.com>
mds: add CEPH_FEATURE_MDSENC feature bit

This will cover the MDS cluster on upgrade, and determine which encoding
of the MDSMap they use for clients.

Signed-off-by: Sage Weil <sage@inktank.com>
Signed-off-by: Greg Farnum <greg@inktank.com>
 mds: Anchor now uses modern encoding

Signed-off-by: Sage Weil <sage@inktank.com>
Signed-off-by: Greg Farnum <greg@inktank.com>
mds: SnapInfo, snaplink_t, sr_t now use modern encoding

This commit doesn't enable the dencoder integration due
to some build and compile issues, but we'll turn it
on later.

Signed-off-by: Sage Weil <sage@inktank.com>
Signed-off-by: Greg Farnum <greg@inktank.com>
client: rename client/SnapRealm files to avoid automake build conflict

We are about to move the MDS' SnapRealm into its own files, which conflicts.
The MDS is more important, so it wins the "SnapRealm" filename and we
move the client stuff to ClientSnapRealm.[h|cc].

Signed-off-by: Sage Weil <sage@inktank.com>
Signed-off-by: Greg Farnum <greg@inktank.com>
mds: move SnapRealm into its own h/cc files

Signed-off-by: Sage Weil <sage@inktank.com>
mds: inode_back{trace,pointer}_t now uses modern encoding

Signed-off-by: Sage Weil <sage@inktank.com>
Signed-off-by: Greg Farnum <greg@inktank.com>
mds: default_file_layout now uses modern encoding

And move implementations into mdstypes.cc from CInode and common/types.
mdstypes.cc sadly lives in libcommon; as several of the types we're going
to put there are needed for Messages and similar things.

Signed-off-by: Sage Weil <sage@inktank.com>
Signed-off-by: Greg Farnum <greg@inktank.com>
mds: frag_info_t now uses modern encoding

Signed-off-by: Sage Weil <sage@inktank.com>
mds: rename struct default_file_layout to file_layout_policy_t

Signed-off-by: Sage Weil <sage@inktank.com>
Signed-off-by: Greg Farnum <greg@inktank.com>
mds: nest_info_t now uses modern encoding

Signed-off-by: Sage Weil <sage@inktank.com>
Signed-off-by: Greg Farnum <greg@inktank.com>
mds: client_writeable_range_t now uses modern encoding

Signed-off-by: Sage Weil <sage@inktank.com>
Signed-off-by: Greg Farnum <greg@inktank.com>
mds: fold byte_range_t into client_writeable_range_t

As part of this, fold byte_range_t into it as a sub-struct
and eliminate its free-standing functions (it's too small
to live alone).

Signed-off-by: Greg Farnum <greg@inktank.com>
mds: inode_t now uses modern encoding

And we move implementations and the dumper into mdstypes.cc (from
mdstypes.h and common/types.cc).

Signed-off-by: Sage Weil <sage@inktank.com>
Signed-off-by: Greg Farnum <greg@inktank.com>
remove common/types.cc

It no longer has a purpose; the functions it used to host are now
implemented in mds/mdstypes.cc and more properly belong there
anyway.

Signed-off-by: Greg Farnum <greg@inktank.com>
mds: old_inode_t now uses modern encoding

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