client: implement RDCACHE reference tracking

make the code be able to track Fc caps used by aysnc buffer reads

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
client: hold Fcr caps during readahead

Fcr caps prevent the file from being truncated.

Fixes: #7958
Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
client: assign implemented caps to caps field of MClientCaps

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
client: properly retain used caps

Pass properly 'retain' to Client::send_cap() because it is used to
adjust cap->issued.

Also make Client::encode_inode_release() not release used/dirty caps.

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
client: drop Fr cap before gettattr CEPH_STAT_CAP_SIZE

When MDS receives the getattr request, corresponding inode's filelock
can be in unstable state which waits for client's Fr cap.

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
client: cleanup Client::_invalidate_inode_cache()

drop parameter 'keep_caps'

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
ObjectCacher: assert no waiter when remove buffer head

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
client: fix null pointer dereference in Client::unlink

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
include/memory: add static_pointer_cast

Signed-off-by: Greg Farnum <greg@inktank.com>
mds: MDRequest: rename to MDRequestImpl, and declare MDRequestRef

We're switching the MDRequest to be used as a shared pointer. This is the
first step on the path to inserting an OpTracker into the MDS.
Give the MDRequestImpl a weak_ptr self_ref so that we can keep
using the elist for now.

Signed-off-by: Greg Farnum <greg@inktank.com>
MDS: Convert the request_start* functions and their immediate callers

Also, the active_requests mapping gets weak pointers.

Signed-off-by: Greg Farnum <greg@inktank.com>
Server: Use MDRequestRef instead of raw pointers

Signed-off-by: Greg Farnum <greg@inktank.com>
MDCache: use MDRequestRef instead of MDRequest*

Signed-off-by: Greg Farnum <greg@inktank.com>
Locker: use MDRequestRef instead of MDRequest*

Signed-off-by: Greg Farnum <greg@inktank.com>
Mutation: rename to MutationImpl and define MutationRef

Signed-off-by: Greg Farnum <greg@inktank.com>
Mutation: move self_ref into MutationImpl instead of MDRequestImpl

We keep an MDRequestImpl::set_self_ref(MDRequestRef&) function so
that we don't need to do the pointer conversion elsewhere.

Signed-off-by: Greg Farnum <greg@inktank.com>
SimpleLock: use MutationRef instead of raw pointers

While we're here, remove the non-const get_xlock_by() (because
we don't need it). Also note we return a full MutationRef
(instead of a ref to the stored one). It's necessary in case we
don't have a set-up more() object.

Signed-off-by: Greg Farnum <greg@inktank.com>
Migrator: use MDRequestRef and MutationRef instead of raw pointers

Signed-off-by: Greg Farnum <greg@inktank.com>
Migrator: use a null ref instead of NULL when calling into path_traverse

Signed-off-by: Greg Farnum <greg@inktank.com>
osd: disable agent when stats_invalid (post-split)

After a split the pg stats are approximate but not precisely correct.  Any
inaccuracy can be problematic for the agent because it determines the
level of effort and potentially full/blocking behavior based on that.

We could concievably do some estimation here that is "safe" in that we
don't commit to too much effort (or back off later if it isn't paying off)
and never block, but that is error-prone.

Instead, just disable the agent until a scrub makes the stats reliable
again.

We should document that a scrub after split is recommended (in any case)
and especially important on cache tiers, but there are currently *no*
user docs about PG splitting.

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