TrackedOp: remove the init_from_message function

I'm not sure why we ever had this instead of just doing things in the
subclass constructor, and the semantics around it don't make much sense
for anything else (we called mark_event first anyway).

Signed-off-by: Greg Farnum <greg@inktank.com>
TrackedOp: introduce a _dump_op_descriptor function

Use this instead of direct access to the Message underneath when dumping
the TrackedOp.

Signed-off-by: Greg Farnum <greg@inktank.com>
TrackedOp: rename arrived_at to initiated_at, specify when constructed

Instead of relying on the message's get_recv_stamp, take a timestamp
when the TrackedOp is constructed. Rename get_received_at() -> get_initiated().

Signed-off-by: Greg Farnum <greg@inktank.com>
TrackedOp: introduce an _unregistered() function to let implementations clean up

Right now, the OpRequest uses it to clean up Message payload data.

Signed-off-by: Greg Farnum <greg@inktank.com>
TrackedOp: do not track a Message

Give it to the OpRequest (currently, the only TrackedOp implementation).

Signed-off-by: Greg Farnum <greg@inktank.com>
TrackedOp: do not require a Message when creating new Ops

Further parameterize the template to allow passing in an arbitrary parameter,
and move all the Message-based event marking from there into OpRequest.

Signed-off-by: Greg Farnum <greg@inktank.com>
client: add debugging around traceless reply failures

Tracking down #5021

Signed-off-by: Sage Weil <sage@inktank.com>
client: leave NULL dentry in place on ENOENT during lookup

If we get a NULL lookup result, unlink the inode but leave the dentry
in place.

Signed-off-by: Sage Weil <sage@inktank.com>
client: avoid blindly removing dentries

MetaRequests may have references to these dentries.  Instead of removing
them and tearing down the directory, just unlink them from the inodes.

We could be a bit smarter here if we looked at the reference count, but
this works too.

Signed-off-by: Sage Weil <sage@inktank.com>
client: handle traceless rename in insert_trace, not verify_reply_trace

The insert_trace() logic is about managing local cache consistency; the
verify_reply_trace() is about retrying requests to get the results that
our callers need.

Set up stubs to handle rmdir and unlink while we are here.

Signed-off-by: Sage Weil <sage@inktank.com>
osd: Remove classic scrub code since Argonaut osd can't join

Fixes: #7553

Signed-off-by: David Zafman <david.zafman@inktank.com>
client: skip insert_trace on safe requests

Only do this for the first reply.

Signed-off-by: Sage Weil <sage@inktank.com>
Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
client: refactor _lookup; fix NULL dentry case

Return ENOENT for a valid NULL dentry in our cache.  Restructure _lookup
to avoid duplicating some code.

Signed-off-by: Sage Weil <sage@inktank.com>
client: do not manually clean up on unlink/rmdir

The reply handler will do this in a safe, ordered fashion.

Signed-off-by: Sage Weil <sage@inktank.com>
client: unlink dentry on traceless rmdir, unlink reply

This used to be handled in _unlink() and _rmdir() even when a trace was
present in the reply, but this is cleaner.

Signed-off-by: Sage Weil <sage@inktank.com>
osd/osd_types: add last_force_op_resend to pg_pool_t

Signed-off-by: Sage Weil <sage@inktank.com>
TrackedOp: create an "initiated" event on construction

This ensures we always have an event for state_string().

Signed-off-by: Greg Farnum <greg@inktank.com>
client: audit unlink() callers

Basically, always keep the dentry and dir, unless we are pruning.

Signed-off-by: Sage Weil <sage@inktank.com>
Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
client: invalidate dentry leases when unlinking

In many case when we are unlinking inodes we also need to invalidate the
dentry lease, as we are not promised that the dentry is NULL.  Be a bit
over-conservative here for good measure.

Signed-off-by: Sage Weil <sage@inktank.com>
Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
client: make less noise when unlinking during readdir

Skip, but do not talk about, NULL dentries.

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