os: free space tracking for MemStore

Allow users to set an artificial upper bound
on size of the memstore OSD, and report actual
usage information in fsstat.

This is a useful tool for simulating nearly-full
systems.

Signed-off-by: John Spray <john.spray@redhat.com>
osdc/Objecter: respect honor_osdmap_full setting

With this, it no longer needs to special case the MDS,
as the MDS can just call unset_honor_osdmap_full.

Signed-off-by: John Spray <john.spray@redhat.com>
osdc/ObjectCacher: invoke flush_set_callback on purge_set

For the benefit of Client, so that it can get its
caps released when using purge_set to deal with
an ENOSPC condition.  Does not affect librbd because
librbd doesn't provide flush_set_callback.

Signed-off-by: John Spray <john.spray@redhat.com>
osdc/Objecter: add op_cancel_writes

This is for use by Client when it encounters
the FULL flag and wants to abort operations
rather than having them pause.

Signed-off-by: John Spray <john.spray@redhat.com>
osdc/Objecter: add have_map method

This is for places we're going to call wait_for_map, so
that we can easily check if we will *probably* get
a true from wait_for_map, and thereby avoid
allocating Contexts we won't need.

Signed-off-by: John Spray <john.spray@redhat.com>
osdc: continuously subscribe to osd map on pause

We were doing this on FULL, should also have done it
on PAUSERD and PAUSEWR, to avoid paused requests
staying that way forever.

Signed-off-by: John Spray <john.spray@redhat.com>
osdc: implement Objecter::set_epoch_barrier

For use in MDS and Client when they want to wait
for a particular OSDMap epoch before using caps
that depend on a prior blacklist or op cancellation.

Signed-off-by: John Spray <john.spray@redhat.com>
osdc: remove spurious _maybe_request_map return value

This was always zero: make the function return void, and
remove all the places we asserted on its return value.

Signed-off-by: John Spray <john.spray@redhat.com>
osdc: add public Objecter::osdmap_full_flag

For the (now numerous) places where callers
would like to check this without doing a verbose
lock/unlock cycle.

Signed-off-by: John Spray <john.spray@redhat.com>
mds: return ENOSPC on write ops while osds full

Allow removals and read-only ops, prevent others.  This
is a soft policy aimed at reducing the likelihood of a
"full" (mon_osd_full_ratio) OSD becoming physically full
(where it is unable to accept journal writes from MDS
even though it does not respect the FULL flag)

Signed-off-by: John Spray <john.spray@redhat.com>
messages: add osd_epoch_barrier to cap msgs

Extension to client-server protocol to allow clients
to release capabilities conditional on the receiver
having a particular OSD map, and the MDS to issue
caps conditional on the user having a particular
OSD map.

Signed-off-by: John Spray <john.spray@redhat.com>
messages: always encode barrier

Instead of truncating on INLINE_DATA, send
some blank fields there for clients that
don't support it (the kclient) in order
that we can include the following
epoch_barrier field.

Signed-off-by: John Spray <john.spray@redhat.com>
mds: implement osd epoch barrier on caps

Signed-off-by: John Spray <john.spray@redhat.com>
mds: set epoch barrier on transition to active

To handle case where MDSs restart after experiencing
a barrier-inducing operation: rather than persisting
OSD barrier somewhere, just have the MDSs always barrier
on latest OSD epoch at startup.

Effect is that after restart, MDS cap issues will
be delayed in (compliant) clients until the client
sees the latest OSD map.

Signed-off-by: John Spray <john.spray@redhat.com>
mds: add 'osdmap barrier' admin command

This is for use with client eviction.

Signed-off-by: John Spray <john.spray@redhat.com>
client: handle ENOSPC in _flush

Previously we would avoid issuing writes
from _write, but the same condition was
not applied to _flush.  This was okay
when we were blocking on ENOSPC, but now
we're cancelling ops on ENOSPC so need
to make sure we don't issue any new ones.

Signed-off-by: John Spray <john.spray@redhat.com>
client: propagate flush errors to fclose/fsync

Ensure that all calls to _flush get an explicit
context (rather than implicit PutInode used
before), which tags any error onto the Inode object.

Later, read the error from the Inode object in _release_fh
and ensure all callers of _release_fh properly handle
its return code.

Signed-off-by: John Spray <john.spray@redhat.com>
client: add 'status' asok

Useful in test/debug for querying OSD epoch
and OSD barrier epoch.

Signed-off-by: John Spray <john.spray@redhat.com>
doc: add cephfs ENOSPC and eviction information

Adding this at this time to give us a sensible place
to talk about the epoch barrier stuff.  The eviction
stuff will probably get simplified once we add a mon-side
eviction command that handles blacklisting and MDS session
eviction in one go.

Signed-off-by: John Spray <john.spray@redhat.com>
Merge pull request #2836 from ceph/wip-7317

#7317 ENOSPC and OSD epoch barrier handling

Reviewed-by: Yan, Zheng <zyan@redhat.com>
Reviewed-by: Greg Farnum <gfarnum@redhat.com>