osd/ReplicatedPG: handle snapdir properly during scrub

Handle snapdir similarly to how head is treated when updating the
next_clone info.  Also, add a warning when we have a snapdir object and
head_exists == true (the converse of the existing check).

Fixes: #7937
Signed-off-by: Sage Weil <sage@inktank.com>
osd/ReplicatedPG: continue scrub logic when snapset.head_exists doesn't match

The 'continue' will cause more damange/noise than continuing because the
next_clone value won't be updated properly.

Signed-off-by: Sage Weil <sage@inktank.com>
PG: set role for replicated even if role != shard

Fixes: #7939
Signed-off-by: Samuel Just <sam.just@inktank.com>
debian: move ceph-rest-api from ceph-common to ceph

ceph-rest-api is a 'server' thing that runs persistently; 'ceph' is a
better match.

Signed-off-by: Sage Weil <sage@inktank.com>
osd/ReplicatedPG: mark_unrollbackable when _rollback_to head

We fell into the case in _rollback_to where we just set ctx->modify = true
and don't explicitly mark the ctx and unrollbackable.  Later, we screw up
in proc_replica_log as a result because we think we can rollback this
update to the head when in reality we cannot.

Fixes: #7907
Signed-off-by: Sage Weil <sage@inktank.com>
debian: make ceph-common own etc/ceph, var/log/ceph

Clients can make use of these directories, and ceph-common is required by
ceph, so nothing should break here.

Change the purge postrm script to be for ceph-common (it does nothing else).

Signed-off-by: Sage Weil <sage@inktank.com>
mds: trim non-auth subtree more aggressively

When a non-auth dirfrag is pinned by uncommitted slave update,
there still can be non-auth child dirfrags that are trimmable.

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
mds: don't start new segment while finishing disambiguate imports

This avoid inserting ESubtreeMap among EImportFinish events that
finish disambiguate imports. Because the ESubtreeMap reflects the
subtree state when all EImportFinish events are replayed.

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
mds: treat cluster as degraded when there is clientreplay MDS

This forbids exporting subtrees and fragmenting dirfrags when there
is MDS in clientreplay state. During replaying client requests, the
MDS may need to authpin some remote objects. Exporting subtrees and
fragmenting dirfrags slow down replaying client requests.

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
mds: handle freeze authpin race

For across authority rename, the MDS first freezes the source inode's
authpin. It happens while the source dentry isn't locked. So when the
inode's authpin become frozen, the source dentry may have changed and
be linked to a different inode.

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
Merge pull request #1584 from ceph/wip-multimds

Wip multimds

Reviewed-by: Sage Weil <sage@inktank.com>
mds: add dentries in dirfrag to LRU in reverse order

Files in a dirfrag are usually processed in the order of readdir
results. Files at the beginning of are more likely to be used in
the future than files at the last.

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
mds: initialize bloom filter according to dirfrag size

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
mds: ignore CDir::check_rstats() when debug_scatterstat is off

It uses lots of CPU when dirfrag is large

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
Merge pull request #1583 from ceph/wip-largedir

Wip largedir

Reviewed-by: Sage Weil <sage@inktank.com>
mds: fix check for merging/spliting dirfrag

check actual number of items instead of number of cached items

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
init.d: correcting rbdmap init order:

 * Require "$remote_fs" since it guarantees /usr availability
   (rbd executable is in /usr/bin/rbd)
 * Speed-up init.d rbd mapping on machines acting as MON/OSD
   by starting rbdmap after /init.d/ceph (when possible) and
   shutting down rbd before ceph.
 * Map rbd devices before starting X (helpful when /home is mounted from rbd).
Merge pull request #1587 from onlyjob/debian

init.d: correcting rbdmap LSB header / init order:

Reviewed-by: Sage Weil <sage@inktank.com>
Merge pull request #1586 from ceph/wip-dirfrag

mds: fix check for merging/spliting dirfrag

Reviewed-by: Sage Weil <sage@inktank.com>
debian: move rbdmap config and sysvinit/upstart scripts into ceph-common

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