rbdmap: per-device post-map/pre-unmap hooks

There are cases when automatic (un-)mounting of file system on RBD is not
enough. Some services may need to be started when RBD device becomes
available (mapped) as well as it may be desirable to stop services in order
to release file system before unmapping RBD device.

File system(s) on RBD is not the only use case scenario. RBD devices may be
used as block devices in which case `/etc/fstab` is not sufficient to
perform action upon mapping RBD device. A handler script (hook) can be
useful to properly release RBD device before unmapping, etc.

Pre-unmap hooks can be important for clean shut down and for re-exporting
RBD device(s) as (iSCSI,AoE,DRBD) etc.

This commit introduces support for per-device hooks to perform per-device
post-map/pre-unmap actions. If hook named like "poolname/imagename" (same
as in `/etc/ceph/rbdmap` file) is found in

    /etc/ceph/rbd.d/poolname/imagename

it is executed as

    /etc/ceph/rbd.d/poolname/imagename map poolname/imagename

following after attempt to mount file system (if relevant `fstab` entry
exist) following mapping of corresponding RBD device.

Before un-mounting file system and un-mapping RBD device hook is called as
follows:

    /etc/ceph/rbd.d/poolname/imagename unmap poolname/imagename

Second argument is intentional to allow multiple RBD devices to share the
same hook (symlinked under different names).

Sample hook to use RBD device as "mdadm" hot spare may look like this:

~~~~
DEV="$2"
case "$1" in
    "map")
        mdadm /dev/md2 --add --write-mostly "${DEV}"
    ;;
    "unmap")
        mdadm /dev/md2 --fail "${DEV}"
        sleep 2
        mdadm /dev/md2 --remove "${DEV}"
    ;;
esac
~~~~

Signed-off-by: Dmitry Smirnov <onlyjob@member.fsf.org>
common/admin_socket: remove dead code

Signed-off-by: John Spray <john.spray@redhat.com>
mon: remove unused attribute notified_global_id

Signed-off-by: John Spray <john.spray@redhat.com>
client: include ID in mds_sessions asok

So that an admin can map a ceph-fuse process
reliably to an entry in the MDS session list.

Signed-off-by: John Spray <john.spray@redhat.com>
mds: add `session ls` and `session evict` to asok

These commands are intended to help admins deal
with MDSs during recovery, to identify troublesome
clients which may need intervention (such as eviction).

Signed-off-by: John Spray <john.spray@redhat.com>
XfsFileStoreBackend: default to disabling extsize on xfs

This appears to be responsible for the deep scrub mismatches on some rbd
workloads.

Fixes: 8830
Signed-off-by: Samuel Just <sam.just@inktank.com>
Merge pull request #2103 from ceph/wip-8830

XfsFileStoreBackend: default to disabling extsize on xfs

Reviewed-by: Sage Weil <sage@redhat.com>
debian: move ceph-dencoder to ceph from ceph-common

It links against the world currently (notably leveldb).  Not nice for the
client-side lib.

Signed-off-by: Sage Weil <sage@redhat.com>
ceph.spec: move ceph-dencoder to ceph from ceph-common

Signed-off-by: Sage Weil <sage@redhat.com>
qa: retire kclient-specific layout test

`cephfs set_layout` was broken and is now deprecated
in favour of using xattrs for layout.  Retire the
kclient-specific test.

Fixes: #8773

Signed-off-by: John Spray <john.spray@redhat.com>
cephfs: pool safety & print deprecation warning

Print a message indicating to users that this tool
is now deprecated in favour of vxattrs.

Signed-off-by: John Spray <john.spray@redhat.com>
doc: add cephfs layout documentation

This clarifies how to deal with layouts in CephFS
using vxattrs.  We can point people here if they
ask what they should use instead of the deprecated
`cephfs set_layout`.

Signed-off-by: John Spray <john.spray@redhat.com>
Fix size of network protocol intergers.

This fixes the size of some integers that are visible in the network
protocol.  There should be no change for machines where sizeof(int) ==
4.

Signed-Of-By: Kevin Cox <kevincox@kevincox.ca>
Merge pull request #2101 from ceph/wip-mds-session-asok-squash

Provide client session handling and information via the admin socket.

Reviewed-by: Greg Farnum <greg@inktank.com>
doc/release-notes: v0.80.4

Signed-off-by: Sage Weil <sage@redhat.com>
init-ceph: wrap daemon startup with systemd-run when running under systemd

We want to make sure the daemon runs in its own systemd environment.  Check
for systemd as pid 1 and, when present, use systemd-run -r <cmd> to do
this.

Probably fixes #7627

Signed-off-by: Sage Weil <sage@redhat.com>
Reviewed-by: Dan Mick <dan.mick@inktank.com>
Tested-by: Dan Mick <dan.mick@inktank.com>
set the default log level to WARNING

Signed-off-by: Alfredo Deza <alfredo.deza@inktank.com>
Merge pull request #2106 from ceph/wip-8813

eat up the level from logging output when not using the `-v` flag

Reviewed-by: Sage Weil <sage@redhat.com>
rgw: don't try to wait for pending if list is empty

Fixes: #8846
Backport: firefly, dumpling

This was broken at ea68b9372319fd0bab40856db26528d36359102e. We ended
up calling wait_pending_front() when pending list was empty.
This commit also moves the need_to_wait check to a different place,
where we actually throttle (and not just drain completed IOs).

Reported-by: Sylvain Munaut <s.munaut@whatever-company.com>
Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
Merge pull request #2107 from ceph/wip-set_layout

Wip set layout

Reviewed-by: Greg Farnum <greg@inktank.com>