client: expose extent/osd mapping

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
libcephfs: return osd location from crush map

Adds ceph_get_osd_crush_location that returns a list of (type,name)
pairs for devices that exist between a given osd and the root of the
bucket hierarchy.

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
Merge remote-tracking branch 'gh/wip-expose-topo'

Reviewed-by: Sage Weil <sage@inktank.com>
osd: add ctor for clone_info

Signed-off-by: Sage Weil <sage@inktank.com>
Missed adding rados_types.hpp to package

Caused by 3bd48cbbadb7908dd833ccde75359f085828fc5c
feature 4207 implementation

Signed-off-by: David Zafman <david.zafman@inktank.com>
Reviewed-by: Gary Lowell <gary.lowell@inktank.com>
Set weight of an osd based on df.
priority to Weight in ceph.conf

Signed-off-by: Guilhem Lettron <guilhem.lettron@youscribe.com>
vstart.sh: osd debug op order = true

Signed-off-by: Sage Weil <sage@inktank.com>
client: handle traceless replies from make_request()

Modify the generic make_request wrapper to retry lookups or getattrs on
requests when the ptarget pointer is specified but there is no trace in
the reply.

Refactor the _create() method to use this, effectively moving all of the
extra_bl code processing into make_request where it is generically
useful.

Signed-off-by: Sage Weil <sage@inktank.com>
client: pass ptarget from link, create, mkdir, symlink, setattr

Use the new make_request functionality to ensure that we properly handle
the re-lookup/getattr when we get a traceless reply back from the MDS.

Note that we have to do this on setattr() because ll_getattr() expects to
return the updated inode metadata to the caller.

Signed-off-by: Sage Weil <sage@inktank.com>
client: clear I_COMPLETE on traceless reply for dentry request

If a request is against a dentry, and we get a traceless reply, clear
the directory I_COMPLETE flag on the parent directory because we can no
longer trust that our cache is complete.

It is possible we could do something a bit more intelligent here, but it
is not trivial because of racing requests, and traceless replies are
rare, so it's not worth the effort.

Signed-off-by: Sage Weil <sage@inktank.com>
client: root can write to any file

Signed-off-by: Sage Weil <sage@inktank.com>
client: handle fh cleanup in ll_create() failure path

Release the fh if we fail the permissions check.

Signed-off-by: Sage Weil <sage@inktank.com>
mds: do not do traceless reply for open O_TRUNC requests

Even though these are "may_write" and may be a mutation, the MDS should not
fake out a traceless reply.  In a real failure, it looks like:

 - mds process request (mutation)
 - mds fails
 - client resends request
 - mds notes that it is O_TRUNC, and already committed, and proceeds with
   a regular open

And that is all fine.

But, that means that if we are trying to simulate this behavior without a
failure, then we should never do a traceless reply on an O_TRUNC request,
because the client will never see such a reply--it'll get a full open
request response instead.

Signed-off-by: Sage Weil <sage@inktank.com>
client: make _do_lookup take a const string

Signed-off-by: Sage Weil <sage@inktank.com>
client: force lookup on traceless reply

Call _do_lookup directly so that we avoid hitting the cache

Signed-off-by: Sage Weil <sage@inktank.com>
client: unlink old_dentry on traceless rename reply

Signed-off-by: Sage Weil <sage@inktank.com>
client: debug created ino

Signed-off-by: Sage Weil <sage@inktank.com>
mds: track created inos with completed request ids in session info

Along with each session completed request (tid), also track the created
ino (if any).  This will be used to pass back to the client when they
replay requests in the next patch.

Do not bother making this a backward compatible encoding.  The only
benefit is to allow ceph-mds code to run and then old mds code to run
after it.  Given all of the other incompat changes we *just* made, this
is highly unlikely and not worth the code clutter.  If we had spanned
more releases or a stable release the story would be different.

While we are here, inline the second add_completed_request() method variant
since there is only a single caller and having it overloaded somewhat
obscures what is going on.  This also avoids a duplicate lookup in the
session map in the have_session() check and then in the (old) helper.

Signed-off-by: Sage Weil <sage@inktank.com>
mds: pass created_ino back to client on replayed requests

After an MDS restart, the client will resend uncommitted requests.  Use the
information we now have in the session_info_t to pass the created ino
back via the extra_bl payload in the reply.

Fixes: #4034
Signed-off-by: Sage Weil <sage@inktank.com>
client: debug async cache invalidation

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