ReplicatedPG: do not create snapdir on head eviction

Head eviction implies that no clones are present.  Also, add
an exists flag to SnapSetContext in order prevent an ssc from
a recent eviction from preventing a snap read from activating
the promotion machinery.

Fixes: #7858
Signed-off-by: Samuel Just <sam.just@inktank.com>
ReplicatedPG::do_op: use get_object_context for list-snaps

find_object_context provides some niceties which we don't need since we know
the oid of the clones.  Problematically, it also return ENOENT if the snap
requested happens to have been removed.  Even in such a case, the clone may
well still exist for other snaps.  Rather than modify find_object_context to
avoid this situation for this caller, we'll simply do it inline in do_op.

Fixes: #7858
Signed-off-by: Samuel Just <sam.just@inktank.com>
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>