diff options
author | Yan, Zheng <zheng.z.yan@intel.com> | 2013-05-06 09:06:52 +0800 |
---|---|---|
committer | Yan, Zheng <zheng.z.yan@intel.com> | 2013-05-28 13:57:21 +0800 |
commit | fc94f47b8bdeb39e9ae919e2ca725c5c3bfe442e (patch) | |
tree | 363ca4e022ae2ead4bccfa29ebe10487cb833fb2 | |
parent | e21f328f1a6a0e675a259dac9b3837c2f7f26d9c (diff) | |
download | ceph-fc94f47b8bdeb39e9ae919e2ca725c5c3bfe442e.tar.gz |
mds: export CInode:mds_caps_wanted
CInode:mds_caps_wanted is used to keep track of caps wanted by non-auth
MDS. The auth MDS checks it when choosing locks' states.
Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
-rw-r--r-- | src/mds/CInode.h | 4 | ||||
-rw-r--r-- | src/mds/Migrator.cc | 7 |
2 files changed, 6 insertions, 5 deletions
diff --git a/src/mds/CInode.h b/src/mds/CInode.h index 47973c2ecf6..727e18c0587 100644 --- a/src/mds/CInode.h +++ b/src/mds/CInode.h @@ -369,7 +369,7 @@ public: protected: // file capabilities map<client_t, Capability*> client_caps; // client -> caps - map<int, int> mds_caps_wanted; // [auth] mds -> caps wanted + map<int32_t, int32_t> mds_caps_wanted; // [auth] mds -> caps wanted int replica_caps_wanted; // [replica] what i've requested from auth map<int, set<client_t> > client_snap_caps; // [auth] [snap] dirty metadata we still need from the head @@ -709,7 +709,7 @@ public: bool is_any_caps() { return !client_caps.empty(); } bool is_any_nonstale_caps() { return count_nonstale_caps(); } - map<int,int>& get_mds_caps_wanted() { return mds_caps_wanted; } + map<int32_t,int32_t>& get_mds_caps_wanted() { return mds_caps_wanted; } map<client_t,Capability*>& get_client_caps() { return client_caps; } Capability *get_client_cap(client_t client) { diff --git a/src/mds/Migrator.cc b/src/mds/Migrator.cc index 5cc26a3e6f2..766ecf9fa8f 100644 --- a/src/mds/Migrator.cc +++ b/src/mds/Migrator.cc @@ -1025,6 +1025,7 @@ void Migrator::encode_export_inode_caps(CInode *in, bufferlist& bl, map<client_t,Capability::Export> cap_map; in->export_client_caps(cap_map); ::encode(cap_map, bl); + ::encode(in->get_mds_caps_wanted(), bl); in->state_set(CInode::STATE_EXPORTINGCAPS); in->get(CInode::PIN_EXPORTINGCAPS); @@ -2379,7 +2380,8 @@ void Migrator::decode_import_inode_caps(CInode *in, { map<client_t,Capability::Export> cap_map; ::decode(cap_map, blp); - if (!cap_map.empty()) { + ::decode(in->get_mds_caps_wanted(), blp); + if (!cap_map.empty() || !in->get_mds_caps_wanted().empty()) { cap_imports[in].swap(cap_map); in->get(CInode::PIN_IMPORTINGCAPS); } @@ -2388,8 +2390,6 @@ void Migrator::decode_import_inode_caps(CInode *in, void Migrator::finish_import_inode_caps(CInode *in, int from, map<client_t,Capability::Export> &cap_map) { - assert(!cap_map.empty()); - for (map<client_t,Capability::Export>::iterator it = cap_map.begin(); it != cap_map.end(); ++it) { @@ -2406,6 +2406,7 @@ void Migrator::finish_import_inode_caps(CInode *in, int from, mds->mdcache->do_cap_import(session, in, cap); } + in->replica_caps_wanted = 0; in->put(CInode::PIN_IMPORTINGCAPS); } |