From: Greg Farnum Date: Tue, 15 Jul 2014 17:42:29 +0000 (-0700) Subject: MDS: MDRequestImpl: provide filepath/filepath2 substitute for MClientRequest X-Git-Tag: v0.89~50^2~21 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=9441283f036d911bef3f5f153f12ceaffae41cae;p=ceph.git 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 --- diff --git a/src/include/filepath.h b/src/include/filepath.h index ec1519d5464e..6d2128b22aeb 100644 --- a/src/include/filepath.h +++ b/src/include/filepath.h @@ -30,6 +30,7 @@ using namespace std; #include "buffer.h" #include "encoding.h" +#include "include/types.h" #include "common/Formatter.h" diff --git a/src/mds/Mutation.cc b/src/mds/Mutation.cc index 2570f278f8ce..3fb54e9b2a6e 100644 --- a/src/mds/Mutation.cc +++ b/src/mds/Mutation.cc @@ -278,6 +278,31 @@ void MDRequestImpl::drop_local_auth_pins() MutationImpl::drop_local_auth_pins(); } +const filepath& MDRequestImpl::get_filepath() +{ + if (client_request) + return client_request->get_filepath(); + return more()->filepath1; +} + +const filepath& MDRequestImpl::get_filepath2() +{ + if (client_request) + return client_request->get_filepath2(); + return more()->filepath2; +} + +void MDRequestImpl::set_filepath(const filepath& fp) +{ + assert(!client_request); + more()->filepath1 = fp; +} +void MDRequestImpl::set_filepath2(const filepath& fp) +{ + assert(!client_request); + more()->filepath2 = fp; +} + void MDRequestImpl::print(ostream &out) { out << "request(" << reqid; diff --git a/src/mds/Mutation.h b/src/mds/Mutation.h index bcc1efe300bb..a7d8de986212 100644 --- a/src/mds/Mutation.h +++ b/src/mds/Mutation.h @@ -17,6 +17,7 @@ #include "include/interval_set.h" #include "include/elist.h" +#include "include/filepath.h" #include "mdstypes.h" @@ -263,6 +264,10 @@ struct MDRequestImpl : public MutationImpl, public TrackedOp { CDir* export_dir; dirfrag_t fragment_base; + // for internal ops doing lookup + filepath filepath1; + filepath filepath2; + More() : has_journaled_slaves(false), slave_update_journaled(false), srcdn_auth_mds(-1), inode_import_v(0), rename_inode(0), @@ -317,6 +322,10 @@ struct MDRequestImpl : public MutationImpl, public TrackedOp { void drop_local_auth_pins(); void set_ambiguous_auth(CInode *inode); void clear_ambiguous_auth(); + const filepath& get_filepath(); + const filepath& get_filepath2(); + void set_filepath(const filepath& fp); + void set_filepath2(const filepath& fp); void print(ostream &out); diff --git a/src/mds/Server.cc b/src/mds/Server.cc index 22b00d744756..9caea1102bd0 100644 --- a/src/mds/Server.cc +++ b/src/mds/Server.cc @@ -2169,8 +2169,7 @@ CInode* Server::rdlock_path_pin_ref(MDRequestRef& mdr, int n, ceph_file_layout **layout, bool no_lookup) // true if we cannot return a null dentry lease { - MClientRequest *req = mdr->client_request; - const filepath& refpath = n ? req->get_filepath2() : req->get_filepath(); + const filepath& refpath = n ? mdr->get_filepath2() : mdr->get_filepath(); dout(10) << "rdlock_path_pin_ref " << *mdr << " " << refpath << dendl; if (mdr->done_locking) @@ -2262,8 +2261,7 @@ CDentry* Server::rdlock_path_xlock_dentry(MDRequestRef& mdr, int n, bool okexist, bool mustexist, bool alwaysxlock, ceph_file_layout **layout) { - MClientRequest *req = mdr->client_request; - const filepath& refpath = n ? req->get_filepath2() : req->get_filepath(); + const filepath& refpath = n ? mdr->get_filepath2() : mdr->get_filepath(); dout(10) << "rdlock_path_xlock_dentry " << *mdr << " " << refpath << dendl;