mds: add an MDSInternalContextWrapper and MDSIOContextWrapper

These let us wrap generic function tooling up inside of the appropriate
type-checking, and verify we haven't done anything too stupid.

Signed-off-by: Greg Farnum <greg@inktank.com>
MDS: CInode: add a fetch_backtrace() utility function

Expose MDCache::fetch_backtrace and call it from the CInode context.

Signed-off-by: Greg Farnum <greg@inktank.com>
MDS: add operator==() and compare() for inode_backtrace_t

The compare() function checks one backtrace against another and indicates
if they're equivalent (or divergent!) and the relative freshness.

Signed-off-by: Greg Farnum <greg@inktank.com>
mdstypes: write inode_t::compare() function

This compares one inode_t against another, seeing which version is newer
and checking that differences in the data members make sense given that.

Signed-off-by: Greg Farnum <greg@inktank.com>
test/mds: unit tests for the inode_backtrace_t and inode_t compare() functions

Signed-off-by: Greg Farnum <greg@inktank.com>
mdstypes: add a same_sums() function to nest_info_t

operator== is checking equality of the version as well, but I want
something I can use to check that the internal sums match. This is useful
for eg comparing the sums of a set of dirfrags to the tally stored in
the inode.

Signed-off-by: Greg Farnum <greg@inktank.com>
MDCache: remove #if 0'd code

Signed-off-by: Greg Farnum <greg@inktank.com>
MDRequest: dump internal op names as well as IDs

Signed-off-by: Greg Farnum <greg@inktank.com>
MDS: MDRequestImpl: provide filepath/filepath2 substitute for MClientRequest

Use this passthru in the Server path locking functions so that we can get
locks or auth pins without an associated MClientRequest.

Signed-off-by: Greg Farnum <greg@inktank.com>
MDCache: create_unlinked_system_inode() as the guts of create_system_inode()

This way we can create duplicate CInodes without actually linking them
into the cache. It'll be helpful for comparing different versions of
disk states and in-memory state, etc.

Signed-off-by: Greg Farnum <greg@inktank.com>
Continuation: Add a new Continuation class.

Signed-off-by: Greg Farnum <greg@inktank.com>
Signed-off-by: John Spray <john.spray@redhat.com>

SQUASH "Continuation: Add a new Continuation class."
Rebase: MDS: Add an MDSContinuation for ease of use

Unlike the regular Continuation, this one works in terms of an MDRequest
and has wrappers to provide Context callbacks that are either
internal MDS or IO appropriate.

Signed-off-by: Greg Farnum <gfarnum@redhat.com>
MDS: CInode::validate_disk_state()

Add a function that will validate the on-disk state of the CInode. We currently
check that the on-disk backtrace matches (or is older) and compare rstats on
dirfrags against the parent dir's inode (for directories only).

TODO: validate that the on-disk Inode object matches what the parent
directory holds.

It's using a sort-of new programming model, trying to stuff stack data into
a Continuation object and write everything sequentially instead of having
a function and Context per IO.

Signed-off-by: Greg Farnum <greg@inktank.com>
Signed-off-by: John Spray <john.spray@redhat.com>
MDS: CInode: implement validated_data::dump()

Signed-off-by: Greg Farnum <greg@inktank.com>
MDCache: add a scrub_dentry() function, and wire it up to the admin socket

scrub_dentry() is passed a string path, and it validates it before replying. We
hook up an admin socket command "scrub_path" to call it and dump the output.

Signed-off-by: Greg Farnum <greg@inktank.com>
Server: remove tracei and tracedn parameters from reply_request

We have members for these two parameters in the MDRequestImpl already, so
make use of them. This helps us move towards dropping the expectation of an
MClientRequest from functions like rdlock_path_pin_ref().

Signed-off-by: Greg Farnum <greg@inktank.com>
Server: do not use explicit MClientReply if we don't need to

Signed-off-by: Greg Farnum <greg@inktank.com>
Server: use mdr->reply_extra_bl instead of explicit MClientReply

Set the MClientReply::extra_bl from reply_extra_bl unconditionally in
reply_request(), instead of only in early_reply(). Further isolate
the reply_request() callers from the use of MClientReply this way.

Signed-off-by: Greg Farnum <greg@inktank.com>
Server: add snapbl to MDRequest and eliminate last explicit MClientReply

Signed-off-by: Greg Farnum <greg@inktank.com>
Server: rename reply_request -> reply_client_request; make it private

The generic reply_request(MDRequest, int) is now the only caller. It's still
just building an MClientRequest to pass along, but we can change it a lot more
easily now to support responding to non-client requests.

Signed-off-by: Greg Farnum <greg@inktank.com>