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>
Server: rename reply_request() -> respond_to_request()

This is no longer necessarily a reply; it could turn into a Context
activation or something.

Signed-off-by: Greg Farnum <greg@inktank.com>
MDCache: "handle" request_forward on internal ops

For now, just return -EXDEV ("Cross-device link") on internal ops that
require forwarding, as forwarding internal ops will require a great deal more
infrastructure.. But push the issue down to this level instead of worrying
about it in path_traverse, and consider the possibility that the MDRequest
might not have a client_request that it's wrapped around.

Signed-off-by: Greg Farnum <greg@inktank.com>
MDCache: make scrub_dentry schedulable and reentrant

Rather than assuming that any necessary inodes are in the cache, split up
MDCache::scrub_dentry into setup and work phases. Add an internal_op_finisher()
to MDRequest. Dispatch any CEPH_MDS_OP_VALIDATE internal operations to
scrub_dentry_work(). Taken together, these make everything work properly when
path_traverse() (by way of rdlock_path_pin_ref()) needs to go to disk before
satisfying the lookup.

Signed-off-by: Greg Farnum <greg@inktank.com>
MDCache: handle internal ops in respond_to_request()

This only works for those which have specified a finisher in the MDR.

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

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

Signed-off-by: Greg Farnum <greg@inktank.com>
common/ceph_strings: add some MDS internal op names to ceph_mds_op_name()

In addition to my validate and flush, this is also missing exportdir.

Signed-off-by: Greg Farnum <greg@inktank.com>
MDS: CInode: break out of validation early on symlinks

Signed-off-by: Greg Farnum <gfarnum@redhat.com>
MDS: clean up internal MDRequests the standard way

All cleanup is now routed through respond_to_request(),
which invokes the internal_op_finish Context*, then does
mdcache->request_finish(). This is easier to reason about,
and indeed fixes a bug (I was not cleaning up locks
following flush). Use the MDSContinuation to facilitate
this in scrub's case.

Signed-off-by: Greg Farnum <gfarnum@redhat.com>
Merge remote-tracking branch 'origin/master' into wip-inode-scrub

Conflicts:
	src/common/Makefile.am
	src/mds/Server.cc

Signed-off-by: Greg Farnum <gfarnum@redhat.com>