]>
Commit | Line | Data |
---|---|---|
11fdf7f2 | 1 | // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- |
7c673cae FG |
2 | // vim: ts=8 sw=2 smarttab |
3 | /* | |
4 | * Ceph - scalable distributed file system | |
5 | * | |
6 | * Copyright (C) 2004-2006 Sage Weil <sage@newdream.net> | |
7 | * | |
8 | * This is free software; you can redistribute it and/or | |
9 | * modify it under the terms of the GNU Lesser General Public | |
10 | * License version 2.1, as published by the Free Software | |
11 | * Foundation. See file COPYING. | |
12 | * | |
13 | */ | |
14 | ||
15 | ||
16 | ||
17 | #ifndef CEPH_MDCACHE_H | |
18 | #define CEPH_MDCACHE_H | |
19 | ||
11fdf7f2 | 20 | #include <string_view> |
94b18763 | 21 | |
a8e16298 | 22 | #include "common/DecayCounter.h" |
7c673cae FG |
23 | #include "include/types.h" |
24 | #include "include/filepath.h" | |
25 | #include "include/elist.h" | |
26 | ||
11fdf7f2 TL |
27 | #include "messages/MCacheExpire.h" |
28 | #include "messages/MClientQuota.h" | |
29 | #include "messages/MClientRequest.h" | |
30 | #include "messages/MClientSnap.h" | |
31 | #include "messages/MDentryLink.h" | |
32 | #include "messages/MDentryUnlink.h" | |
33 | #include "messages/MDirUpdate.h" | |
34 | #include "messages/MDiscover.h" | |
35 | #include "messages/MDiscoverReply.h" | |
36 | #include "messages/MGatherCaps.h" | |
37 | #include "messages/MGenericMessage.h" | |
38 | #include "messages/MInodeFileCaps.h" | |
39 | #include "messages/MLock.h" | |
40 | #include "messages/MMDSCacheRejoin.h" | |
41 | #include "messages/MMDSFindIno.h" | |
42 | #include "messages/MMDSFindInoReply.h" | |
43 | #include "messages/MMDSFragmentNotify.h" | |
44 | #include "messages/MMDSFragmentNotifyAck.h" | |
45 | #include "messages/MMDSOpenIno.h" | |
46 | #include "messages/MMDSOpenInoReply.h" | |
47 | #include "messages/MMDSResolve.h" | |
48 | #include "messages/MMDSResolveAck.h" | |
49 | #include "messages/MMDSSlaveRequest.h" | |
50 | #include "messages/MMDSSnapUpdate.h" | |
51 | ||
52 | ||
7c673cae FG |
53 | #include "osdc/Filer.h" |
54 | #include "CInode.h" | |
55 | #include "CDentry.h" | |
56 | #include "CDir.h" | |
57 | #include "include/Context.h" | |
58 | #include "events/EMetaBlob.h" | |
59 | #include "RecoveryQueue.h" | |
60 | #include "StrayManager.h" | |
11fdf7f2 | 61 | #include "OpenFileTable.h" |
7c673cae FG |
62 | #include "MDSContext.h" |
63 | #include "MDSMap.h" | |
64 | #include "Mutation.h" | |
65 | ||
7c673cae FG |
66 | |
67 | class PerfCounters; | |
68 | ||
69 | class MDSRank; | |
70 | class Session; | |
71 | class Migrator; | |
72 | ||
7c673cae FG |
73 | class Session; |
74 | ||
7c673cae FG |
75 | class ESubtreeMap; |
76 | ||
77 | enum { | |
78 | l_mdc_first = 3000, | |
79 | // How many inodes currently in stray dentries | |
80 | l_mdc_num_strays, | |
81 | // How many stray dentries are currently delayed for purge due to refs | |
82 | l_mdc_num_strays_delayed, | |
83 | // How many stray dentries are currently being enqueued for purge | |
84 | l_mdc_num_strays_enqueuing, | |
85 | ||
86 | // How many dentries have ever been added to stray dir | |
87 | l_mdc_strays_created, | |
88 | // How many dentries have been passed on to PurgeQueue | |
89 | l_mdc_strays_enqueued, | |
90 | // How many strays have been reintegrated? | |
91 | l_mdc_strays_reintegrated, | |
92 | // How many strays have been migrated? | |
93 | l_mdc_strays_migrated, | |
94 | ||
95 | // How many inode sizes currently being recovered | |
96 | l_mdc_num_recovering_processing, | |
97 | // How many inodes currently waiting to have size recovered | |
98 | l_mdc_num_recovering_enqueued, | |
99 | // How many inodes waiting with elevated priority for recovery | |
100 | l_mdc_num_recovering_prioritized, | |
101 | // How many inodes ever started size recovery | |
102 | l_mdc_recovery_started, | |
103 | // How many inodes ever completed size recovery | |
104 | l_mdc_recovery_completed, | |
105 | ||
d2e6a577 FG |
106 | l_mdss_ireq_enqueue_scrub, |
107 | l_mdss_ireq_exportdir, | |
108 | l_mdss_ireq_flush, | |
109 | l_mdss_ireq_fragmentdir, | |
110 | l_mdss_ireq_fragstats, | |
111 | l_mdss_ireq_inodestats, | |
112 | ||
7c673cae FG |
113 | l_mdc_last, |
114 | }; | |
115 | ||
116 | ||
117 | // flags for predirty_journal_parents() | |
118 | static const int PREDIRTY_PRIMARY = 1; // primary dn, adjust nested accounting | |
119 | static const int PREDIRTY_DIR = 2; // update parent dir mtime/size | |
120 | static const int PREDIRTY_SHALLOW = 4; // only go to immediate parent (for easier rollback) | |
121 | ||
122 | class MDCache { | |
123 | public: | |
91327a77 AA |
124 | using clock = ceph::coarse_mono_clock; |
125 | using time = ceph::coarse_mono_time; | |
126 | ||
11fdf7f2 TL |
127 | typedef std::map<mds_rank_t, MCacheExpire::ref> expiremap; |
128 | ||
7c673cae FG |
129 | // my master |
130 | MDSRank *mds; | |
131 | ||
132 | // -- my cache -- | |
133 | LRU lru; // dentry lru for expiring items from cache | |
31f18b77 | 134 | LRU bottom_lru; // dentries that should be trimmed ASAP |
7c673cae | 135 | protected: |
b32b8144 FG |
136 | ceph::unordered_map<inodeno_t,CInode*> inode_map; // map of head inodes by ino |
137 | map<vinodeno_t, CInode*> snap_inode_map; // map of snap inodes by ino | |
7c673cae FG |
138 | CInode *root; // root inode |
139 | CInode *myin; // .ceph/mds%d dir | |
140 | ||
141 | bool readonly; | |
142 | void set_readonly() { readonly = true; } | |
143 | ||
144 | CInode *strays[NUM_STRAY]; // my stray dir | |
145 | int stray_index; | |
146 | ||
147 | CInode *get_stray() { | |
148 | return strays[stray_index]; | |
149 | } | |
150 | ||
151 | set<CInode*> base_inodes; | |
152 | ||
153 | std::unique_ptr<PerfCounters> logger; | |
154 | ||
155 | Filer filer; | |
156 | ||
157 | bool exceeded_size_limit; | |
158 | ||
91327a77 AA |
159 | private: |
160 | uint64_t cache_inode_limit; | |
161 | uint64_t cache_memory_limit; | |
162 | double cache_reservation; | |
163 | double cache_health_threshold; | |
164 | ||
7c673cae | 165 | public: |
91327a77 AA |
166 | uint64_t cache_limit_inodes(void) { |
167 | return cache_inode_limit; | |
181888fb | 168 | } |
91327a77 AA |
169 | uint64_t cache_limit_memory(void) { |
170 | return cache_memory_limit; | |
181888fb FG |
171 | } |
172 | double cache_toofull_ratio(void) const { | |
91327a77 AA |
173 | double inode_reserve = cache_inode_limit*(1.0-cache_reservation); |
174 | double memory_reserve = cache_memory_limit*(1.0-cache_reservation); | |
175 | return fmax(0.0, fmax((cache_size()-memory_reserve)/memory_reserve, cache_inode_limit == 0 ? 0.0 : (CInode::count()-inode_reserve)/inode_reserve)); | |
181888fb FG |
176 | } |
177 | bool cache_toofull(void) const { | |
178 | return cache_toofull_ratio() > 0.0; | |
179 | } | |
180 | uint64_t cache_size(void) const { | |
181 | return mempool::get_pool(mempool::mds_co::id).allocated_bytes(); | |
182 | } | |
183 | bool cache_overfull(void) const { | |
91327a77 | 184 | return (cache_inode_limit > 0 && CInode::count() > cache_inode_limit*cache_health_threshold) || (cache_size() > cache_memory_limit*cache_health_threshold); |
181888fb FG |
185 | } |
186 | ||
7c673cae FG |
187 | void advance_stray() { |
188 | stray_index = (stray_index+1)%NUM_STRAY; | |
189 | } | |
190 | ||
7c673cae FG |
191 | /** |
192 | * Call this when you know that a CDentry is ready to be passed | |
193 | * on to StrayManager (i.e. this is a stray you've just created) | |
194 | */ | |
195 | void notify_stray(CDentry *dn) { | |
11fdf7f2 | 196 | ceph_assert(dn->get_dir()->get_inode()->is_stray()); |
a8e16298 TL |
197 | if (dn->state_test(CDentry::STATE_PURGING)) |
198 | return; | |
199 | ||
7c673cae FG |
200 | stray_manager.eval_stray(dn); |
201 | } | |
202 | ||
203 | void maybe_eval_stray(CInode *in, bool delay=false); | |
31f18b77 FG |
204 | void clear_dirty_bits_for_stray(CInode* diri); |
205 | ||
7c673cae FG |
206 | bool is_readonly() { return readonly; } |
207 | void force_readonly(); | |
208 | ||
209 | DecayRate decayrate; | |
210 | ||
b32b8144 FG |
211 | int num_shadow_inodes; |
212 | ||
7c673cae FG |
213 | int num_inodes_with_caps; |
214 | ||
215 | unsigned max_dir_commit_size; | |
216 | ||
217 | static file_layout_t gen_default_file_layout(const MDSMap &mdsmap); | |
218 | static file_layout_t gen_default_log_layout(const MDSMap &mdsmap); | |
219 | ||
220 | file_layout_t default_file_layout; | |
221 | file_layout_t default_log_layout; | |
222 | ||
223 | void register_perfcounters(); | |
224 | ||
225 | // -- client leases -- | |
226 | public: | |
227 | static const int client_lease_pools = 3; | |
228 | float client_lease_durations[client_lease_pools]; | |
229 | protected: | |
230 | xlist<ClientLease*> client_leases[client_lease_pools]; | |
231 | public: | |
232 | void touch_client_lease(ClientLease *r, int pool, utime_t ttl) { | |
233 | client_leases[pool].push_back(&r->item_lease); | |
234 | r->ttl = ttl; | |
235 | } | |
236 | ||
237 | void notify_stray_removed() | |
238 | { | |
239 | stray_manager.notify_stray_removed(); | |
240 | } | |
241 | ||
242 | void notify_stray_created() | |
243 | { | |
244 | stray_manager.notify_stray_created(); | |
245 | } | |
246 | ||
31f18b77 FG |
247 | void eval_remote(CDentry *dn) |
248 | { | |
249 | stray_manager.eval_remote(dn); | |
250 | } | |
251 | ||
7c673cae FG |
252 | // -- client caps -- |
253 | uint64_t last_cap_id; | |
254 | ||
255 | ||
256 | ||
257 | // -- discover -- | |
258 | struct discover_info_t { | |
259 | ceph_tid_t tid; | |
260 | mds_rank_t mds; | |
261 | inodeno_t ino; | |
262 | frag_t frag; | |
263 | snapid_t snap; | |
264 | filepath want_path; | |
31f18b77 | 265 | CInode *basei; |
7c673cae FG |
266 | bool want_base_dir; |
267 | bool want_xlocked; | |
268 | ||
269 | discover_info_t() : | |
31f18b77 | 270 | tid(0), mds(-1), snap(CEPH_NOSNAP), basei(NULL), |
7c673cae FG |
271 | want_base_dir(false), want_xlocked(false) {} |
272 | ~discover_info_t() { | |
31f18b77 FG |
273 | if (basei) |
274 | basei->put(MDSCacheObject::PIN_DISCOVERBASE); | |
7c673cae | 275 | } |
31f18b77 FG |
276 | void pin_base(CInode *b) { |
277 | basei = b; | |
278 | basei->get(MDSCacheObject::PIN_DISCOVERBASE); | |
7c673cae FG |
279 | } |
280 | }; | |
281 | ||
282 | map<ceph_tid_t, discover_info_t> discovers; | |
283 | ceph_tid_t discover_last_tid; | |
284 | ||
285 | void _send_discover(discover_info_t& dis); | |
286 | discover_info_t& _create_discover(mds_rank_t mds) { | |
287 | ceph_tid_t t = ++discover_last_tid; | |
288 | discover_info_t& d = discovers[t]; | |
289 | d.tid = t; | |
290 | d.mds = mds; | |
291 | return d; | |
292 | } | |
293 | ||
294 | // waiters | |
11fdf7f2 | 295 | map<int, map<inodeno_t, MDSContext::vec > > waiting_for_base_ino; |
7c673cae | 296 | |
11fdf7f2 TL |
297 | void discover_base_ino(inodeno_t want_ino, MDSContext *onfinish, mds_rank_t from=MDS_RANK_NONE); |
298 | void discover_dir_frag(CInode *base, frag_t approx_fg, MDSContext *onfinish, | |
7c673cae | 299 | mds_rank_t from=MDS_RANK_NONE); |
11fdf7f2 | 300 | void discover_path(CInode *base, snapid_t snap, filepath want_path, MDSContext *onfinish, |
7c673cae | 301 | bool want_xlocked=false, mds_rank_t from=MDS_RANK_NONE); |
11fdf7f2 | 302 | void discover_path(CDir *base, snapid_t snap, filepath want_path, MDSContext *onfinish, |
7c673cae FG |
303 | bool want_xlocked=false); |
304 | void kick_discovers(mds_rank_t who); // after a failure. | |
305 | ||
306 | ||
307 | // -- subtrees -- | |
81eedcae TL |
308 | private: |
309 | static const unsigned int SUBTREES_COUNT_THRESHOLD = 5; | |
310 | static const unsigned int SUBTREES_DEPTH_THRESHOLD = 5; | |
7c673cae FG |
311 | protected: |
312 | /* subtree keys and each tree's non-recursive nested subtrees (the "bounds") */ | |
313 | map<CDir*,set<CDir*> > subtrees; | |
314 | map<CInode*,list<pair<CDir*,CDir*> > > projected_subtree_renames; // renamed ino -> target dir | |
315 | ||
316 | // adjust subtree auth specification | |
317 | // dir->dir_auth | |
318 | // imports/exports/nested_exports | |
319 | // join/split subtrees as appropriate | |
320 | public: | |
321 | bool is_subtrees() { return !subtrees.empty(); } | |
11fdf7f2 TL |
322 | template<typename T> |
323 | void get_subtrees(T& c) { | |
324 | if constexpr (std::is_same_v<T, std::vector<CDir*>>) | |
325 | c.reserve(c.size() + subtrees.size()); | |
326 | for (const auto& p : subtrees) { | |
327 | c.push_back(p.first); | |
328 | } | |
329 | } | |
28e407b8 | 330 | void adjust_subtree_auth(CDir *root, mds_authority_t auth, bool adjust_pop=true); |
224ce89b WB |
331 | void adjust_subtree_auth(CDir *root, mds_rank_t a, mds_rank_t b=CDIR_AUTH_UNKNOWN) { |
332 | adjust_subtree_auth(root, mds_authority_t(a,b)); | |
7c673cae | 333 | } |
11fdf7f2 TL |
334 | void adjust_bounded_subtree_auth(CDir *dir, const set<CDir*>& bounds, mds_authority_t auth); |
335 | void adjust_bounded_subtree_auth(CDir *dir, const set<CDir*>& bounds, mds_rank_t a) { | |
7c673cae FG |
336 | adjust_bounded_subtree_auth(dir, bounds, mds_authority_t(a, CDIR_AUTH_UNKNOWN)); |
337 | } | |
11fdf7f2 TL |
338 | void adjust_bounded_subtree_auth(CDir *dir, const vector<dirfrag_t>& bounds, const mds_authority_t &auth); |
339 | void adjust_bounded_subtree_auth(CDir *dir, const vector<dirfrag_t>& bounds, mds_rank_t a) { | |
7c673cae FG |
340 | adjust_bounded_subtree_auth(dir, bounds, mds_authority_t(a, CDIR_AUTH_UNKNOWN)); |
341 | } | |
11fdf7f2 | 342 | void map_dirfrag_set(const list<dirfrag_t>& dfs, set<CDir*>& result); |
7c673cae | 343 | void try_subtree_merge(CDir *root); |
28e407b8 | 344 | void try_subtree_merge_at(CDir *root, set<CInode*> *to_eval, bool adjust_pop=true); |
7c673cae FG |
345 | void subtree_merge_writebehind_finish(CInode *in, MutationRef& mut); |
346 | void eval_subtree_root(CInode *diri); | |
347 | CDir *get_subtree_root(CDir *dir); | |
348 | CDir *get_projected_subtree_root(CDir *dir); | |
349 | bool is_leaf_subtree(CDir *dir) { | |
11fdf7f2 | 350 | ceph_assert(subtrees.count(dir)); |
7c673cae FG |
351 | return subtrees[dir].empty(); |
352 | } | |
353 | void remove_subtree(CDir *dir); | |
354 | bool is_subtree(CDir *root) { | |
355 | return subtrees.count(root); | |
356 | } | |
357 | void get_subtree_bounds(CDir *root, set<CDir*>& bounds); | |
358 | void get_wouldbe_subtree_bounds(CDir *root, set<CDir*>& bounds); | |
359 | void verify_subtree_bounds(CDir *root, const set<CDir*>& bounds); | |
360 | void verify_subtree_bounds(CDir *root, const list<dirfrag_t>& bounds); | |
361 | ||
362 | void project_subtree_rename(CInode *diri, CDir *olddir, CDir *newdir); | |
224ce89b | 363 | void adjust_subtree_after_rename(CInode *diri, CDir *olddir, bool pop); |
7c673cae | 364 | |
11fdf7f2 TL |
365 | auto get_auth_subtrees() { |
366 | std::vector<CDir*> c; | |
367 | for (auto& p : subtrees) { | |
368 | auto& root = p.first; | |
369 | if (root->is_auth()) { | |
370 | c.push_back(root); | |
371 | } | |
372 | } | |
373 | return c; | |
374 | } | |
7c673cae | 375 | |
11fdf7f2 TL |
376 | auto get_fullauth_subtrees() { |
377 | std::vector<CDir*> c; | |
378 | for (auto& p : subtrees) { | |
379 | auto& root = p.first; | |
380 | if (root->is_full_dir_auth()) { | |
381 | c.push_back(root); | |
382 | } | |
383 | } | |
384 | return c; | |
385 | } | |
386 | auto num_subtrees_fullauth() const { | |
387 | std::size_t n = 0; | |
388 | for (auto& p : subtrees) { | |
389 | auto& root = p.first; | |
390 | if (root->is_full_dir_auth()) { | |
391 | ++n; | |
392 | } | |
393 | } | |
394 | return n; | |
395 | } | |
7c673cae | 396 | |
11fdf7f2 TL |
397 | auto num_subtrees_fullnonauth() const { |
398 | std::size_t n = 0; | |
399 | for (auto& p : subtrees) { | |
400 | auto& root = p.first; | |
401 | if (root->is_full_dir_nonauth()) { | |
402 | ++n; | |
403 | } | |
404 | } | |
405 | return n; | |
406 | } | |
7c673cae | 407 | |
11fdf7f2 TL |
408 | auto num_subtrees() const { |
409 | return subtrees.size(); | |
410 | } | |
7c673cae | 411 | |
11fdf7f2 TL |
412 | |
413 | protected: | |
7c673cae FG |
414 | // -- requests -- |
415 | ceph::unordered_map<metareqid_t, MDRequestRef> active_requests; | |
416 | ||
417 | public: | |
418 | int get_num_client_requests(); | |
419 | ||
11fdf7f2 TL |
420 | MDRequestRef request_start(const MClientRequest::const_ref& req); |
421 | MDRequestRef request_start_slave(metareqid_t rid, __u32 attempt, const Message::const_ref &m); | |
7c673cae FG |
422 | MDRequestRef request_start_internal(int op); |
423 | bool have_request(metareqid_t rid) { | |
424 | return active_requests.count(rid); | |
425 | } | |
426 | MDRequestRef request_get(metareqid_t rid); | |
427 | void request_pin_ref(MDRequestRef& r, CInode *ref, vector<CDentry*>& trace); | |
428 | void request_finish(MDRequestRef& mdr); | |
429 | void request_forward(MDRequestRef& mdr, mds_rank_t mds, int port=0); | |
430 | void dispatch_request(MDRequestRef& mdr); | |
431 | void request_drop_foreign_locks(MDRequestRef& mdr); | |
432 | void request_drop_non_rdlocks(MDRequestRef& r); | |
433 | void request_drop_locks(MDRequestRef& r); | |
434 | void request_cleanup(MDRequestRef& r); | |
435 | ||
436 | void request_kill(MDRequestRef& r); // called when session closes | |
437 | ||
438 | // journal/snap helpers | |
439 | CInode *pick_inode_snap(CInode *in, snapid_t follows); | |
440 | CInode *cow_inode(CInode *in, snapid_t last); | |
441 | void journal_cow_dentry(MutationImpl *mut, EMetaBlob *metablob, CDentry *dn, | |
442 | snapid_t follows=CEPH_NOSNAP, | |
443 | CInode **pcow_inode=0, CDentry::linkage_t *dnl=0); | |
444 | void journal_cow_inode(MutationRef& mut, EMetaBlob *metablob, CInode *in, snapid_t follows=CEPH_NOSNAP, | |
445 | CInode **pcow_inode=0); | |
446 | void journal_dirty_inode(MutationImpl *mut, EMetaBlob *metablob, CInode *in, snapid_t follows=CEPH_NOSNAP); | |
447 | ||
448 | void project_rstat_inode_to_frag(CInode *cur, CDir *parent, snapid_t first, | |
449 | int linkunlink, SnapRealm *prealm); | |
94b18763 | 450 | void _project_rstat_inode_to_frag(CInode::mempool_inode & inode, snapid_t ofirst, snapid_t last, |
7c673cae FG |
451 | CDir *parent, int linkunlink, bool update_inode); |
452 | void project_rstat_frag_to_inode(nest_info_t& rstat, nest_info_t& accounted_rstat, | |
453 | snapid_t ofirst, snapid_t last, | |
454 | CInode *pin, bool cow_head); | |
a8e16298 | 455 | void broadcast_quota_to_client(CInode *in, client_t exclude_ct = -1, bool quota_change = false); |
7c673cae FG |
456 | void predirty_journal_parents(MutationRef mut, EMetaBlob *blob, |
457 | CInode *in, CDir *parent, | |
458 | int flags, int linkunlink=0, | |
459 | snapid_t follows=CEPH_NOSNAP); | |
460 | ||
461 | // slaves | |
462 | void add_uncommitted_master(metareqid_t reqid, LogSegment *ls, set<mds_rank_t> &slaves, bool safe=false) { | |
463 | uncommitted_masters[reqid].ls = ls; | |
464 | uncommitted_masters[reqid].slaves = slaves; | |
465 | uncommitted_masters[reqid].safe = safe; | |
466 | } | |
11fdf7f2 | 467 | void wait_for_uncommitted_master(metareqid_t reqid, MDSContext *c) { |
7c673cae FG |
468 | uncommitted_masters[reqid].waiters.push_back(c); |
469 | } | |
470 | bool have_uncommitted_master(metareqid_t reqid, mds_rank_t from) { | |
471 | auto p = uncommitted_masters.find(reqid); | |
472 | return p != uncommitted_masters.end() && p->second.slaves.count(from) > 0; | |
473 | } | |
474 | void log_master_commit(metareqid_t reqid); | |
475 | void logged_master_update(metareqid_t reqid); | |
476 | void _logged_master_commit(metareqid_t reqid); | |
477 | void committed_master_slave(metareqid_t r, mds_rank_t from); | |
478 | void finish_committed_masters(); | |
479 | ||
480 | void _logged_slave_commit(mds_rank_t from, metareqid_t reqid); | |
481 | ||
482 | // -- recovery -- | |
483 | protected: | |
484 | set<mds_rank_t> recovery_set; | |
485 | ||
486 | public: | |
487 | void set_recovery_set(set<mds_rank_t>& s); | |
488 | void handle_mds_failure(mds_rank_t who); | |
489 | void handle_mds_recovery(mds_rank_t who); | |
490 | ||
491 | protected: | |
492 | // [resolve] | |
493 | // from EImportStart w/o EImportFinish during journal replay | |
494 | map<dirfrag_t, vector<dirfrag_t> > my_ambiguous_imports; | |
495 | // from MMDSResolves | |
496 | map<mds_rank_t, map<dirfrag_t, vector<dirfrag_t> > > other_ambiguous_imports; | |
497 | ||
498 | map<mds_rank_t, map<metareqid_t, MDSlaveUpdate*> > uncommitted_slave_updates; // slave: for replay. | |
499 | map<CInode*, int> uncommitted_slave_rename_olddir; // slave: preserve the non-auth dir until seeing commit. | |
500 | map<CInode*, int> uncommitted_slave_unlink; // slave: preserve the unlinked inode until seeing commit. | |
501 | ||
502 | // track master requests whose slaves haven't acknowledged commit | |
503 | struct umaster { | |
504 | set<mds_rank_t> slaves; | |
505 | LogSegment *ls; | |
11fdf7f2 | 506 | MDSContext::vec waiters; |
7c673cae FG |
507 | bool safe; |
508 | bool committing; | |
509 | bool recovering; | |
510 | umaster() : ls(NULL), safe(false), committing(false), recovering(false) {} | |
511 | }; | |
512 | map<metareqid_t, umaster> uncommitted_masters; // master: req -> slave set | |
513 | ||
514 | set<metareqid_t> pending_masters; | |
515 | map<int, set<metareqid_t> > ambiguous_slave_updates; | |
516 | ||
517 | friend class ESlaveUpdate; | |
518 | friend class ECommitted; | |
519 | ||
520 | bool resolves_pending; | |
521 | set<mds_rank_t> resolve_gather; // nodes i need resolves from | |
522 | set<mds_rank_t> resolve_ack_gather; // nodes i need a resolve_ack from | |
11fdf7f2 TL |
523 | set<version_t> resolve_snapclient_commits; |
524 | map<metareqid_t, mds_rank_t> resolve_need_rollback; // rollbacks i'm writing to the journal | |
525 | map<mds_rank_t, MMDSResolve::const_ref> delayed_resolve; | |
7c673cae | 526 | |
11fdf7f2 TL |
527 | void handle_resolve(const MMDSResolve::const_ref &m); |
528 | void handle_resolve_ack(const MMDSResolveAck::const_ref &m); | |
7c673cae FG |
529 | void process_delayed_resolve(); |
530 | void discard_delayed_resolve(mds_rank_t who); | |
531 | void maybe_resolve_finish(); | |
532 | void disambiguate_my_imports(); | |
533 | void disambiguate_other_imports(); | |
534 | void trim_unlinked_inodes(); | |
535 | void add_uncommitted_slave_update(metareqid_t reqid, mds_rank_t master, MDSlaveUpdate*); | |
536 | void finish_uncommitted_slave_update(metareqid_t reqid, mds_rank_t master); | |
537 | MDSlaveUpdate* get_uncommitted_slave_update(metareqid_t reqid, mds_rank_t master); | |
11fdf7f2 TL |
538 | |
539 | void send_slave_resolves(); | |
540 | void send_subtree_resolves(); | |
541 | void maybe_finish_slave_resolve(); | |
542 | ||
7c673cae FG |
543 | public: |
544 | void recalc_auth_bits(bool replay); | |
545 | void remove_inode_recursive(CInode *in); | |
546 | ||
547 | bool is_ambiguous_slave_update(metareqid_t reqid, mds_rank_t master) { | |
548 | auto p = ambiguous_slave_updates.find(master); | |
549 | return p != ambiguous_slave_updates.end() && p->second.count(reqid); | |
550 | } | |
551 | void add_ambiguous_slave_update(metareqid_t reqid, mds_rank_t master) { | |
552 | ambiguous_slave_updates[master].insert(reqid); | |
553 | } | |
554 | void remove_ambiguous_slave_update(metareqid_t reqid, mds_rank_t master) { | |
555 | auto p = ambiguous_slave_updates.find(master); | |
556 | auto q = p->second.find(reqid); | |
11fdf7f2 | 557 | ceph_assert(q != p->second.end()); |
7c673cae FG |
558 | p->second.erase(q); |
559 | if (p->second.empty()) | |
560 | ambiguous_slave_updates.erase(p); | |
561 | } | |
562 | ||
563 | void add_rollback(metareqid_t reqid, mds_rank_t master) { | |
11fdf7f2 | 564 | resolve_need_rollback[reqid] = master; |
7c673cae FG |
565 | } |
566 | void finish_rollback(metareqid_t reqid); | |
567 | ||
568 | // ambiguous imports | |
569 | void add_ambiguous_import(dirfrag_t base, const vector<dirfrag_t>& bounds); | |
570 | void add_ambiguous_import(CDir *base, const set<CDir*>& bounds); | |
571 | bool have_ambiguous_import(dirfrag_t base) { | |
572 | return my_ambiguous_imports.count(base); | |
573 | } | |
574 | void get_ambiguous_import_bounds(dirfrag_t base, vector<dirfrag_t>& bounds) { | |
11fdf7f2 | 575 | ceph_assert(my_ambiguous_imports.count(base)); |
7c673cae FG |
576 | bounds = my_ambiguous_imports[base]; |
577 | } | |
578 | void cancel_ambiguous_import(CDir *); | |
579 | void finish_ambiguous_import(dirfrag_t dirino); | |
11fdf7f2 | 580 | void resolve_start(MDSContext *resolve_done_); |
7c673cae | 581 | void send_resolves(); |
7c673cae FG |
582 | void maybe_send_pending_resolves() { |
583 | if (resolves_pending) | |
584 | send_subtree_resolves(); | |
585 | } | |
586 | ||
587 | void _move_subtree_map_bound(dirfrag_t df, dirfrag_t oldparent, dirfrag_t newparent, | |
588 | map<dirfrag_t,vector<dirfrag_t> >& subtrees); | |
589 | ESubtreeMap *create_subtree_map(); | |
590 | ||
591 | ||
592 | void clean_open_file_lists(); | |
11fdf7f2 TL |
593 | void dump_openfiles(Formatter *f); |
594 | bool dump_inode(Formatter *f, uint64_t number); | |
7c673cae FG |
595 | protected: |
596 | // [rejoin] | |
597 | bool rejoins_pending; | |
598 | set<mds_rank_t> rejoin_gather; // nodes from whom i need a rejoin | |
599 | set<mds_rank_t> rejoin_sent; // nodes i sent a rejoin to | |
31f18b77 | 600 | set<mds_rank_t> rejoin_ack_sent; // nodes i sent a rejoin to |
7c673cae FG |
601 | set<mds_rank_t> rejoin_ack_gather; // nodes from whom i need a rejoin ack |
602 | map<mds_rank_t,map<inodeno_t,map<client_t,Capability::Import> > > rejoin_imported_caps; | |
603 | map<inodeno_t,pair<mds_rank_t,map<client_t,Capability::Export> > > rejoin_slave_exports; | |
11fdf7f2 | 604 | |
7c673cae | 605 | map<client_t,entity_inst_t> rejoin_client_map; |
11fdf7f2 | 606 | map<client_t,client_metadata_t> rejoin_client_metadata_map; |
28e407b8 | 607 | map<client_t,pair<Session*,uint64_t> > rejoin_session_map; |
7c673cae | 608 | |
28e407b8 | 609 | map<inodeno_t,pair<mds_rank_t,map<client_t,cap_reconnect_t> > > cap_exports; // ino -> target, client -> capex |
7c673cae FG |
610 | |
611 | map<inodeno_t,map<client_t,map<mds_rank_t,cap_reconnect_t> > > cap_imports; // ino -> client -> frommds -> capex | |
612 | set<inodeno_t> cap_imports_missing; | |
11fdf7f2 | 613 | map<inodeno_t, MDSContext::vec > cap_reconnect_waiters; |
7c673cae FG |
614 | int cap_imports_num_opening; |
615 | ||
616 | set<CInode*> rejoin_undef_inodes; | |
617 | set<CInode*> rejoin_potential_updated_scatterlocks; | |
618 | set<CDir*> rejoin_undef_dirfrags; | |
619 | map<mds_rank_t, set<CInode*> > rejoin_unlinked_inodes; | |
620 | ||
621 | vector<CInode*> rejoin_recover_q, rejoin_check_q; | |
622 | list<SimpleLock*> rejoin_eval_locks; | |
11fdf7f2 | 623 | MDSContext::vec rejoin_waiters; |
7c673cae | 624 | |
11fdf7f2 TL |
625 | void rejoin_walk(CDir *dir, const MMDSCacheRejoin::ref &rejoin); |
626 | void handle_cache_rejoin(const MMDSCacheRejoin::const_ref &m); | |
627 | void handle_cache_rejoin_weak(const MMDSCacheRejoin::const_ref &m); | |
7c673cae FG |
628 | CInode* rejoin_invent_inode(inodeno_t ino, snapid_t last); |
629 | CDir* rejoin_invent_dirfrag(dirfrag_t df); | |
11fdf7f2 TL |
630 | void handle_cache_rejoin_strong(const MMDSCacheRejoin::const_ref &m); |
631 | void rejoin_scour_survivor_replicas(mds_rank_t from, const MMDSCacheRejoin::const_ref &ack, | |
7c673cae FG |
632 | set<vinodeno_t>& acked_inodes, |
633 | set<SimpleLock *>& gather_locks); | |
11fdf7f2 | 634 | void handle_cache_rejoin_ack(const MMDSCacheRejoin::const_ref &m); |
7c673cae FG |
635 | void rejoin_send_acks(); |
636 | void rejoin_trim_undef_inodes(); | |
637 | void maybe_send_pending_rejoins() { | |
638 | if (rejoins_pending) | |
639 | rejoin_send_rejoins(); | |
640 | } | |
11fdf7f2 TL |
641 | std::unique_ptr<MDSContext> rejoin_done; |
642 | std::unique_ptr<MDSContext> resolve_done; | |
7c673cae | 643 | public: |
11fdf7f2 | 644 | void rejoin_start(MDSContext *rejoin_done_); |
7c673cae FG |
645 | void rejoin_gather_finish(); |
646 | void rejoin_send_rejoins(); | |
647 | void rejoin_export_caps(inodeno_t ino, client_t client, const cap_reconnect_t& icr, | |
11fdf7f2 | 648 | int target=-1, bool drop_path=false) { |
28e407b8 AA |
649 | auto& ex = cap_exports[ino]; |
650 | ex.first = target; | |
11fdf7f2 TL |
651 | auto &_icr = ex.second[client] = icr; |
652 | if (drop_path) | |
653 | _icr.path.clear(); | |
7c673cae FG |
654 | } |
655 | void rejoin_recovered_caps(inodeno_t ino, client_t client, const cap_reconnect_t& icr, | |
11fdf7f2 TL |
656 | mds_rank_t frommds=MDS_RANK_NONE, bool drop_path=false) { |
657 | auto &_icr = cap_imports[ino][client][frommds] = icr; | |
658 | if (drop_path) | |
659 | _icr.path.clear(); | |
7c673cae | 660 | } |
28e407b8 AA |
661 | void rejoin_recovered_client(client_t client, const entity_inst_t& inst) { |
662 | rejoin_client_map.emplace(client, inst); | |
663 | } | |
11fdf7f2 TL |
664 | bool rejoin_has_cap_reconnect(inodeno_t ino) const { |
665 | return cap_imports.count(ino); | |
666 | } | |
667 | void add_replay_ino_alloc(inodeno_t ino) { | |
668 | cap_imports_missing.insert(ino); // avoid opening ino during cache rejoin | |
669 | } | |
7c673cae FG |
670 | const cap_reconnect_t *get_replay_cap_reconnect(inodeno_t ino, client_t client) { |
671 | if (cap_imports.count(ino) && | |
672 | cap_imports[ino].count(client) && | |
673 | cap_imports[ino][client].count(MDS_RANK_NONE)) { | |
674 | return &cap_imports[ino][client][MDS_RANK_NONE]; | |
675 | } | |
676 | return NULL; | |
677 | } | |
678 | void remove_replay_cap_reconnect(inodeno_t ino, client_t client) { | |
11fdf7f2 TL |
679 | ceph_assert(cap_imports[ino].size() == 1); |
680 | ceph_assert(cap_imports[ino][client].size() == 1); | |
7c673cae FG |
681 | cap_imports.erase(ino); |
682 | } | |
11fdf7f2 | 683 | void wait_replay_cap_reconnect(inodeno_t ino, MDSContext *c) { |
7c673cae FG |
684 | cap_reconnect_waiters[ino].push_back(c); |
685 | } | |
686 | ||
687 | // [reconnect/rejoin caps] | |
688 | struct reconnected_cap_info_t { | |
689 | inodeno_t realm_ino; | |
690 | snapid_t snap_follows; | |
691 | int dirty_caps; | |
11fdf7f2 | 692 | bool snapflush; |
7c673cae | 693 | reconnected_cap_info_t() : |
11fdf7f2 | 694 | realm_ino(0), snap_follows(0), dirty_caps(0), snapflush(false) {} |
7c673cae FG |
695 | }; |
696 | map<inodeno_t,map<client_t, reconnected_cap_info_t> > reconnected_caps; // inode -> client -> snap_follows,realmino | |
697 | map<inodeno_t,map<client_t, snapid_t> > reconnected_snaprealms; // realmino -> client -> realmseq | |
698 | ||
699 | void add_reconnected_cap(client_t client, inodeno_t ino, const cap_reconnect_t& icr) { | |
700 | reconnected_cap_info_t &info = reconnected_caps[ino][client]; | |
701 | info.realm_ino = inodeno_t(icr.capinfo.snaprealm); | |
702 | info.snap_follows = icr.snap_follows; | |
703 | } | |
11fdf7f2 | 704 | void set_reconnected_dirty_caps(client_t client, inodeno_t ino, int dirty, bool snapflush) { |
7c673cae FG |
705 | reconnected_cap_info_t &info = reconnected_caps[ino][client]; |
706 | info.dirty_caps |= dirty; | |
11fdf7f2 TL |
707 | if (snapflush) |
708 | info.snapflush = snapflush; | |
7c673cae FG |
709 | } |
710 | void add_reconnected_snaprealm(client_t client, inodeno_t ino, snapid_t seq) { | |
711 | reconnected_snaprealms[ino][client] = seq; | |
712 | } | |
713 | ||
714 | friend class C_MDC_RejoinOpenInoFinish; | |
715 | friend class C_MDC_RejoinSessionsOpened; | |
716 | void rejoin_open_ino_finish(inodeno_t ino, int ret); | |
11fdf7f2 | 717 | void rejoin_prefetch_ino_finish(inodeno_t ino, int ret); |
28e407b8 | 718 | void rejoin_open_sessions_finish(map<client_t,pair<Session*,uint64_t> >& session_map); |
7c673cae FG |
719 | bool process_imported_caps(); |
720 | void choose_lock_states_and_reconnect_caps(); | |
721 | void prepare_realm_split(SnapRealm *realm, client_t client, inodeno_t ino, | |
11fdf7f2 TL |
722 | map<client_t,MClientSnap::ref>& splits); |
723 | void prepare_realm_merge(SnapRealm *realm, SnapRealm *parent_realm, map<client_t,MClientSnap::ref>& splits); | |
724 | void send_snaps(map<client_t,MClientSnap::ref>& splits); | |
7c673cae | 725 | Capability* rejoin_import_cap(CInode *in, client_t client, const cap_reconnect_t& icr, mds_rank_t frommds); |
11fdf7f2 TL |
726 | void finish_snaprealm_reconnect(client_t client, SnapRealm *realm, snapid_t seq, |
727 | map<client_t,MClientSnap::ref>& updates); | |
a8e16298 | 728 | Capability* try_reconnect_cap(CInode *in, Session *session); |
7c673cae FG |
729 | void export_remaining_imported_caps(); |
730 | ||
11fdf7f2 TL |
731 | // realm inodes |
732 | set<CInode*> rejoin_pending_snaprealms; | |
7c673cae | 733 | // cap imports. delayed snap parent opens. |
7c673cae FG |
734 | map<client_t,set<CInode*> > delayed_imported_caps; |
735 | ||
736 | void do_cap_import(Session *session, CInode *in, Capability *cap, | |
737 | uint64_t p_cap_id, ceph_seq_t p_seq, ceph_seq_t p_mseq, | |
738 | int peer, int p_flags); | |
739 | void do_delayed_cap_imports(); | |
740 | void rebuild_need_snapflush(CInode *head_in, SnapRealm *realm, client_t client, | |
741 | snapid_t snap_follows); | |
11fdf7f2 | 742 | void open_snaprealms(); |
7c673cae FG |
743 | |
744 | bool open_undef_inodes_dirfrags(); | |
745 | void opened_undef_inode(CInode *in); | |
746 | void opened_undef_dirfrag(CDir *dir) { | |
747 | rejoin_undef_dirfrags.erase(dir); | |
748 | } | |
749 | ||
750 | void reissue_all_caps(); | |
751 | ||
752 | ||
753 | friend class Locker; | |
754 | friend class Migrator; | |
755 | friend class MDBalancer; | |
756 | ||
757 | // StrayManager needs to be able to remove_inode() from us | |
758 | // when it is done purging | |
759 | friend class StrayManager; | |
760 | ||
761 | // File size recovery | |
762 | private: | |
763 | RecoveryQueue recovery_queue; | |
764 | void identify_files_to_recover(); | |
765 | public: | |
766 | void start_files_to_recover(); | |
767 | void do_file_recover(); | |
768 | void queue_file_recover(CInode *in); | |
769 | void _queued_file_recover_cow(CInode *in, MutationRef& mut); | |
770 | ||
771 | // subsystems | |
772 | std::unique_ptr<Migrator> migrator; | |
773 | ||
774 | public: | |
775 | explicit MDCache(MDSRank *m, PurgeQueue &purge_queue_); | |
776 | ~MDCache(); | |
11fdf7f2 | 777 | void handle_conf_change(const ConfigProxy& conf, |
91327a77 AA |
778 | const std::set <std::string> &changed, |
779 | const MDSMap &mds_map); | |
7c673cae FG |
780 | |
781 | // debug | |
782 | void log_stat(); | |
783 | ||
784 | // root inode | |
785 | CInode *get_root() { return root; } | |
786 | CInode *get_myin() { return myin; } | |
787 | ||
7c673cae FG |
788 | size_t get_cache_size() { return lru.lru_get_size(); } |
789 | ||
790 | // trimming | |
a8e16298 | 791 | std::pair<bool, uint64_t> trim(uint64_t count=0); |
181888fb | 792 | private: |
11fdf7f2 TL |
793 | std::pair<bool, uint64_t> trim_lru(uint64_t count, expiremap& expiremap); |
794 | bool trim_dentry(CDentry *dn, expiremap& expiremap); | |
795 | void trim_dirfrag(CDir *dir, CDir *con, expiremap& expiremap); | |
796 | bool trim_inode(CDentry *dn, CInode *in, CDir *con, expiremap&); | |
797 | void send_expire_messages(expiremap& expiremap); | |
7c673cae | 798 | void trim_non_auth(); // trim out trimmable non-auth items |
181888fb | 799 | public: |
7c673cae FG |
800 | bool trim_non_auth_subtree(CDir *directory); |
801 | void standby_trim_segment(LogSegment *ls); | |
802 | void try_trim_non_auth_subtree(CDir *dir); | |
803 | bool can_trim_non_auth_dirfrag(CDir *dir) { | |
804 | return my_ambiguous_imports.count((dir)->dirfrag()) == 0 && | |
805 | uncommitted_slave_rename_olddir.count(dir->inode) == 0; | |
806 | } | |
807 | ||
808 | /** | |
809 | * For all unreferenced inodes, dirs, dentries below an inode, compose | |
810 | * expiry messages. This is used when giving up all replicas of entities | |
811 | * for an MDS peer in the 'stopping' state, such that the peer can | |
812 | * empty its cache and finish shutting down. | |
813 | * | |
814 | * We have to make sure we're only expiring un-referenced items to | |
815 | * avoid interfering with ongoing stray-movement (we can't distinguish | |
816 | * between the "moving my strays" and "waiting for my cache to empty" | |
817 | * phases within 'stopping') | |
818 | * | |
819 | * @return false if we completed cleanly, true if caller should stop | |
820 | * expiring because we hit something with refs. | |
821 | */ | |
11fdf7f2 | 822 | bool expire_recursive(CInode *in, expiremap& expiremap); |
7c673cae FG |
823 | |
824 | void trim_client_leases(); | |
825 | void check_memory_usage(); | |
826 | ||
7c673cae FG |
827 | // shutdown |
828 | private: | |
f64942e4 AA |
829 | set<inodeno_t> shutdown_exporting_strays; |
830 | pair<dirfrag_t, string> shutdown_export_next; | |
7c673cae FG |
831 | public: |
832 | void shutdown_start(); | |
833 | void shutdown_check(); | |
834 | bool shutdown_pass(); | |
7c673cae | 835 | bool shutdown(); // clear cache (ie at shutodwn) |
f64942e4 AA |
836 | bool shutdown_export_strays(); |
837 | void shutdown_export_stray_finish(inodeno_t ino) { | |
838 | if (shutdown_exporting_strays.erase(ino)) | |
839 | shutdown_export_strays(); | |
840 | } | |
7c673cae FG |
841 | |
842 | bool did_shutdown_log_cap; | |
843 | ||
844 | // inode_map | |
845 | bool have_inode(vinodeno_t vino) { | |
b32b8144 FG |
846 | if (vino.snapid == CEPH_NOSNAP) |
847 | return inode_map.count(vino.ino) ? true : false; | |
848 | else | |
849 | return snap_inode_map.count(vino) ? true : false; | |
7c673cae FG |
850 | } |
851 | bool have_inode(inodeno_t ino, snapid_t snap=CEPH_NOSNAP) { | |
852 | return have_inode(vinodeno_t(ino, snap)); | |
853 | } | |
854 | CInode* get_inode(vinodeno_t vino) { | |
b32b8144 FG |
855 | if (vino.snapid == CEPH_NOSNAP) { |
856 | auto p = inode_map.find(vino.ino); | |
857 | if (p != inode_map.end()) | |
858 | return p->second; | |
859 | } else { | |
860 | auto p = snap_inode_map.find(vino); | |
861 | if (p != snap_inode_map.end()) | |
862 | return p->second; | |
863 | } | |
7c673cae FG |
864 | return NULL; |
865 | } | |
866 | CInode* get_inode(inodeno_t ino, snapid_t s=CEPH_NOSNAP) { | |
867 | return get_inode(vinodeno_t(ino, s)); | |
868 | } | |
11fdf7f2 TL |
869 | CInode* lookup_snap_inode(vinodeno_t vino) { |
870 | auto p = snap_inode_map.lower_bound(vino); | |
871 | if (p != snap_inode_map.end() && | |
872 | p->second->ino() == vino.ino && p->second->first <= vino.snapid) | |
873 | return p->second; | |
874 | return NULL; | |
875 | } | |
7c673cae FG |
876 | |
877 | CDir* get_dirfrag(dirfrag_t df) { | |
878 | CInode *in = get_inode(df.ino); | |
879 | if (!in) | |
880 | return NULL; | |
881 | return in->get_dirfrag(df.frag); | |
882 | } | |
11fdf7f2 | 883 | CDir* get_dirfrag(inodeno_t ino, std::string_view dn) { |
7c673cae FG |
884 | CInode *in = get_inode(ino); |
885 | if (!in) | |
886 | return NULL; | |
887 | frag_t fg = in->pick_dirfrag(dn); | |
888 | return in->get_dirfrag(fg); | |
889 | } | |
890 | CDir* get_force_dirfrag(dirfrag_t df, bool replay) { | |
891 | CInode *diri = get_inode(df.ino); | |
892 | if (!diri) | |
893 | return NULL; | |
894 | CDir *dir = force_dir_fragment(diri, df.frag, replay); | |
895 | if (!dir) | |
896 | dir = diri->get_dirfrag(df.frag); | |
897 | return dir; | |
898 | } | |
899 | ||
11fdf7f2 | 900 | MDSCacheObject *get_object(const MDSCacheObjectInfo &info); |
7c673cae FG |
901 | |
902 | ||
903 | ||
904 | public: | |
905 | void add_inode(CInode *in); | |
906 | ||
907 | void remove_inode(CInode *in); | |
908 | protected: | |
909 | void touch_inode(CInode *in) { | |
910 | if (in->get_parent_dn()) | |
911 | touch_dentry(in->get_projected_parent_dn()); | |
912 | } | |
913 | public: | |
914 | void touch_dentry(CDentry *dn) { | |
31f18b77 FG |
915 | if (dn->state_test(CDentry::STATE_BOTTOMLRU)) { |
916 | bottom_lru.lru_midtouch(dn); | |
917 | } else { | |
918 | if (dn->is_auth()) | |
919 | lru.lru_touch(dn); | |
920 | else | |
921 | lru.lru_midtouch(dn); | |
922 | } | |
7c673cae FG |
923 | } |
924 | void touch_dentry_bottom(CDentry *dn) { | |
31f18b77 FG |
925 | if (dn->state_test(CDentry::STATE_BOTTOMLRU)) |
926 | return; | |
7c673cae | 927 | lru.lru_bottouch(dn); |
7c673cae FG |
928 | } |
929 | protected: | |
930 | ||
931 | void inode_remove_replica(CInode *in, mds_rank_t rep, bool rejoin, | |
932 | set<SimpleLock *>& gather_locks); | |
933 | void dentry_remove_replica(CDentry *dn, mds_rank_t rep, set<SimpleLock *>& gather_locks); | |
934 | ||
935 | void rename_file(CDentry *srcdn, CDentry *destdn); | |
936 | ||
937 | public: | |
938 | // truncate | |
939 | void truncate_inode(CInode *in, LogSegment *ls); | |
940 | void _truncate_inode(CInode *in, LogSegment *ls); | |
941 | void truncate_inode_finish(CInode *in, LogSegment *ls); | |
942 | void truncate_inode_logged(CInode *in, MutationRef& mut); | |
943 | ||
944 | void add_recovered_truncate(CInode *in, LogSegment *ls); | |
945 | void remove_recovered_truncate(CInode *in, LogSegment *ls); | |
946 | void start_recovered_truncates(); | |
947 | ||
948 | ||
949 | public: | |
950 | CDir *get_auth_container(CDir *in); | |
951 | CDir *get_export_container(CDir *dir); | |
952 | void find_nested_exports(CDir *dir, set<CDir*>& s); | |
953 | void find_nested_exports_under(CDir *import, CDir *dir, set<CDir*>& s); | |
954 | ||
955 | ||
956 | private: | |
957 | bool opening_root, open; | |
11fdf7f2 | 958 | MDSContext::vec waiting_for_open; |
7c673cae FG |
959 | |
960 | public: | |
961 | void init_layouts(); | |
962 | void create_unlinked_system_inode(CInode *in, inodeno_t ino, | |
963 | int mode) const; | |
964 | CInode *create_system_inode(inodeno_t ino, int mode); | |
965 | CInode *create_root_inode(); | |
966 | ||
967 | void create_empty_hierarchy(MDSGather *gather); | |
968 | void create_mydir_hierarchy(MDSGather *gather); | |
969 | ||
970 | bool is_open() { return open; } | |
11fdf7f2 | 971 | void wait_for_open(MDSContext *c) { |
7c673cae FG |
972 | waiting_for_open.push_back(c); |
973 | } | |
974 | ||
11fdf7f2 | 975 | void open_root_inode(MDSContext *c); |
7c673cae | 976 | void open_root(); |
11fdf7f2 TL |
977 | void open_mydir_inode(MDSContext *c); |
978 | void open_mydir_frag(MDSContext *c); | |
7c673cae FG |
979 | void populate_mydir(); |
980 | ||
11fdf7f2 | 981 | void _create_system_file(CDir *dir, std::string_view name, CInode *in, MDSContext *fin); |
7c673cae | 982 | void _create_system_file_finish(MutationRef& mut, CDentry *dn, |
11fdf7f2 | 983 | version_t dpv, MDSContext *fin); |
7c673cae | 984 | |
11fdf7f2 | 985 | void open_foreign_mdsdir(inodeno_t ino, MDSContext *c); |
7c673cae FG |
986 | CDir *get_stray_dir(CInode *in); |
987 | CDentry *get_or_create_stray_dentry(CInode *in); | |
988 | ||
7c673cae FG |
989 | /** |
990 | * Find the given dentry (and whether it exists or not), its ancestors, | |
991 | * and get them all into memory and usable on this MDS. This function | |
992 | * makes a best-effort attempt to load everything; if it needs to | |
993 | * go away and do something then it will put the request on a waitlist. | |
994 | * It prefers the mdr, then the req, then the fin. (At least one of these | |
995 | * must be non-null.) | |
996 | * | |
997 | * At least one of the params mdr, req, and fin must be non-null. | |
998 | * | |
999 | * @param mdr The MDRequest associated with the path. Can be null. | |
11fdf7f2 | 1000 | * @param cf A MDSContextFactory for waiter building. |
7c673cae FG |
1001 | * @param path The path to traverse to. |
1002 | * @param pdnvec Data return parameter -- on success, contains a | |
1003 | * vector of dentries. On failure, is either empty or contains the | |
1004 | * full trace of traversable dentries. | |
1005 | * @param pin Data return parameter -- if successful, points to the inode | |
1006 | * associated with filepath. If unsuccessful, is null. | |
1007 | * @param onfail Specifies different lookup failure behaviors. If set to | |
1008 | * MDS_TRAVERSE_DISCOVERXLOCK, path_traverse will succeed on null | |
1009 | * dentries (instead of returning -ENOENT). If set to | |
1010 | * MDS_TRAVERSE_FORWARD, it will forward the request to the auth | |
1011 | * MDS if that becomes appropriate (ie, if it doesn't know the contents | |
1012 | * of a directory). If set to MDS_TRAVERSE_DISCOVER, it | |
1013 | * will attempt to look up the path from a different MDS (and bring them | |
1014 | * into its cache as replicas). | |
1015 | * | |
1016 | * @returns 0 on success, 1 on "not done yet", 2 on "forwarding", -errno otherwise. | |
1017 | * If it returns 1, the requester associated with this call has been placed | |
1018 | * on the appropriate waitlist, and it should unwind itself and back out. | |
1019 | * If it returns 2 the request has been forwarded, and again the requester | |
1020 | * should unwind itself and back out. | |
1021 | */ | |
11fdf7f2 | 1022 | int path_traverse(MDRequestRef& mdr, MDSContextFactory& cf, const filepath& path, |
7c673cae FG |
1023 | vector<CDentry*> *pdnvec, CInode **pin, int onfail); |
1024 | ||
1025 | CInode *cache_traverse(const filepath& path); | |
1026 | ||
11fdf7f2 | 1027 | void open_remote_dirfrag(CInode *diri, frag_t fg, MDSContext *fin); |
7c673cae FG |
1028 | CInode *get_dentry_inode(CDentry *dn, MDRequestRef& mdr, bool projected=false); |
1029 | ||
1030 | bool parallel_fetch(map<inodeno_t,filepath>& pathmap, set<inodeno_t>& missing); | |
1031 | bool parallel_fetch_traverse_dir(inodeno_t ino, filepath& path, | |
1032 | set<CDir*>& fetch_queue, set<inodeno_t>& missing, | |
1033 | C_GatherBuilder &gather_bld); | |
1034 | ||
11fdf7f2 | 1035 | void open_remote_dentry(CDentry *dn, bool projected, MDSContext *fin, |
7c673cae | 1036 | bool want_xlocked=false); |
11fdf7f2 | 1037 | void _open_remote_dentry_finish(CDentry *dn, inodeno_t ino, MDSContext *fin, |
7c673cae FG |
1038 | bool want_xlocked, int r); |
1039 | ||
1040 | void make_trace(vector<CDentry*>& trace, CInode *in); | |
1041 | ||
1042 | protected: | |
1043 | struct open_ino_info_t { | |
1044 | vector<inode_backpointer_t> ancestors; | |
1045 | set<mds_rank_t> checked; | |
1046 | mds_rank_t checking; | |
1047 | mds_rank_t auth_hint; | |
1048 | bool check_peers; | |
1049 | bool fetch_backtrace; | |
1050 | bool discover; | |
1051 | bool want_replica; | |
1052 | bool want_xlocked; | |
1053 | version_t tid; | |
1054 | int64_t pool; | |
1055 | int last_err; | |
11fdf7f2 | 1056 | MDSContext::vec waiters; |
7c673cae FG |
1057 | open_ino_info_t() : checking(MDS_RANK_NONE), auth_hint(MDS_RANK_NONE), |
1058 | check_peers(true), fetch_backtrace(true), discover(false), | |
1059 | want_replica(false), want_xlocked(false), tid(0), pool(-1), | |
1060 | last_err(0) {} | |
1061 | }; | |
1062 | ceph_tid_t open_ino_last_tid; | |
1063 | map<inodeno_t,open_ino_info_t> opening_inodes; | |
1064 | ||
1065 | void _open_ino_backtrace_fetched(inodeno_t ino, bufferlist& bl, int err); | |
1066 | void _open_ino_parent_opened(inodeno_t ino, int ret); | |
1067 | void _open_ino_traverse_dir(inodeno_t ino, open_ino_info_t& info, int err); | |
11fdf7f2 TL |
1068 | void _open_ino_fetch_dir(inodeno_t ino, const MMDSOpenIno::const_ref &m, CDir *dir, bool parent); |
1069 | int open_ino_traverse_dir(inodeno_t ino, const MMDSOpenIno::const_ref &m, | |
1070 | const vector<inode_backpointer_t>& ancestors, | |
7c673cae FG |
1071 | bool discover, bool want_xlocked, mds_rank_t *hint); |
1072 | void open_ino_finish(inodeno_t ino, open_ino_info_t& info, int err); | |
1073 | void do_open_ino(inodeno_t ino, open_ino_info_t& info, int err); | |
1074 | void do_open_ino_peer(inodeno_t ino, open_ino_info_t& info); | |
11fdf7f2 TL |
1075 | void handle_open_ino(const MMDSOpenIno::const_ref &m, int err=0); |
1076 | void handle_open_ino_reply(const MMDSOpenInoReply::const_ref &m); | |
7c673cae FG |
1077 | friend class C_IO_MDC_OpenInoBacktraceFetched; |
1078 | friend struct C_MDC_OpenInoTraverseDir; | |
1079 | friend struct C_MDC_OpenInoParentOpened; | |
1080 | ||
1081 | public: | |
1082 | void kick_open_ino_peers(mds_rank_t who); | |
11fdf7f2 | 1083 | void open_ino(inodeno_t ino, int64_t pool, MDSContext *fin, |
7c673cae FG |
1084 | bool want_replica=true, bool want_xlocked=false); |
1085 | ||
1086 | // -- find_ino_peer -- | |
1087 | struct find_ino_peer_info_t { | |
1088 | inodeno_t ino; | |
1089 | ceph_tid_t tid; | |
11fdf7f2 | 1090 | MDSContext *fin; |
7c673cae FG |
1091 | mds_rank_t hint; |
1092 | mds_rank_t checking; | |
1093 | set<mds_rank_t> checked; | |
1094 | ||
1095 | find_ino_peer_info_t() : tid(0), fin(NULL), hint(MDS_RANK_NONE), checking(MDS_RANK_NONE) {} | |
1096 | }; | |
1097 | ||
1098 | map<ceph_tid_t, find_ino_peer_info_t> find_ino_peer; | |
1099 | ceph_tid_t find_ino_peer_last_tid; | |
1100 | ||
11fdf7f2 | 1101 | void find_ino_peers(inodeno_t ino, MDSContext *c, mds_rank_t hint=MDS_RANK_NONE); |
7c673cae | 1102 | void _do_find_ino_peer(find_ino_peer_info_t& fip); |
11fdf7f2 TL |
1103 | void handle_find_ino(const MMDSFindIno::const_ref &m); |
1104 | void handle_find_ino_reply(const MMDSFindInoReply::const_ref &m); | |
7c673cae FG |
1105 | void kick_find_ino_peers(mds_rank_t who); |
1106 | ||
1107 | // -- snaprealms -- | |
11fdf7f2 TL |
1108 | private: |
1109 | SnapRealm *global_snaprealm; | |
7c673cae | 1110 | public: |
11fdf7f2 TL |
1111 | SnapRealm *get_global_snaprealm() const { return global_snaprealm; } |
1112 | void create_global_snaprealm(); | |
1113 | void do_realm_invalidate_and_update_notify(CInode *in, int snapop, bool notify_clients=true); | |
1114 | void send_snap_update(CInode *in, version_t stid, int snap_op); | |
1115 | void handle_snap_update(const MMDSSnapUpdate::const_ref &m); | |
1116 | void notify_global_snaprealm_update(int snap_op); | |
7c673cae FG |
1117 | |
1118 | // -- stray -- | |
1119 | public: | |
7c673cae FG |
1120 | void fetch_backtrace(inodeno_t ino, int64_t pool, bufferlist& bl, Context *fin); |
1121 | uint64_t get_num_strays() const { return stray_manager.get_num_strays(); } | |
1122 | ||
1123 | protected: | |
1124 | void scan_stray_dir(dirfrag_t next=dirfrag_t()); | |
1125 | StrayManager stray_manager; | |
1126 | friend struct C_MDC_RetryScanStray; | |
7c673cae FG |
1127 | |
1128 | // == messages == | |
1129 | public: | |
11fdf7f2 | 1130 | void dispatch(const Message::const_ref &m); |
7c673cae FG |
1131 | |
1132 | protected: | |
1133 | // -- replicas -- | |
11fdf7f2 TL |
1134 | void handle_discover(const MDiscover::const_ref &dis); |
1135 | void handle_discover_reply(const MDiscoverReply::const_ref &m); | |
7c673cae FG |
1136 | friend class C_MDC_Join; |
1137 | ||
1138 | public: | |
b32b8144 FG |
1139 | void replicate_dir(CDir *dir, mds_rank_t to, bufferlist& bl); |
1140 | void replicate_dentry(CDentry *dn, mds_rank_t to, bufferlist& bl); | |
7c673cae | 1141 | void replicate_inode(CInode *in, mds_rank_t to, bufferlist& bl, |
b32b8144 | 1142 | uint64_t features); |
7c673cae | 1143 | |
11fdf7f2 TL |
1144 | CDir* add_replica_dir(bufferlist::const_iterator& p, CInode *diri, mds_rank_t from, MDSContext::vec& finished); |
1145 | CDentry *add_replica_dentry(bufferlist::const_iterator& p, CDir *dir, MDSContext::vec& finished); | |
1146 | CInode *add_replica_inode(bufferlist::const_iterator& p, CDentry *dn, MDSContext::vec& finished); | |
7c673cae FG |
1147 | |
1148 | void replicate_stray(CDentry *straydn, mds_rank_t who, bufferlist& bl); | |
11fdf7f2 | 1149 | CDentry *add_replica_stray(const bufferlist &bl, mds_rank_t from); |
7c673cae FG |
1150 | |
1151 | // -- namespace -- | |
1152 | public: | |
1153 | void send_dentry_link(CDentry *dn, MDRequestRef& mdr); | |
1154 | void send_dentry_unlink(CDentry *dn, CDentry *straydn, MDRequestRef& mdr); | |
1155 | protected: | |
11fdf7f2 TL |
1156 | void handle_dentry_link(const MDentryLink::const_ref &m); |
1157 | void handle_dentry_unlink(const MDentryUnlink::const_ref &m); | |
7c673cae FG |
1158 | |
1159 | ||
1160 | // -- fragmenting -- | |
1161 | private: | |
1162 | struct ufragment { | |
1163 | int bits; | |
1164 | bool committed; | |
1165 | LogSegment *ls; | |
11fdf7f2 TL |
1166 | MDSContext::vec waiters; |
1167 | frag_vec_t old_frags; | |
7c673cae FG |
1168 | bufferlist rollback; |
1169 | ufragment() : bits(0), committed(false), ls(NULL) {} | |
1170 | }; | |
1171 | map<dirfrag_t, ufragment> uncommitted_fragments; | |
1172 | ||
1173 | struct fragment_info_t { | |
1174 | int bits; | |
1175 | list<CDir*> dirs; | |
1176 | list<CDir*> resultfrags; | |
1177 | MDRequestRef mdr; | |
a8e16298 TL |
1178 | set<mds_rank_t> notify_ack_waiting; |
1179 | bool finishing = false; | |
1180 | ||
7c673cae | 1181 | // for deadlock detection |
a8e16298 | 1182 | bool all_frozen = false; |
7c673cae | 1183 | utime_t last_cum_auth_pins_change; |
a8e16298 TL |
1184 | int last_cum_auth_pins = 0; |
1185 | int num_remote_waiters = 0; // number of remote authpin waiters | |
1186 | fragment_info_t() {} | |
7c673cae | 1187 | bool is_fragmenting() { return !resultfrags.empty(); } |
a8e16298 | 1188 | uint64_t get_tid() { return mdr ? mdr->reqid.tid : 0; } |
7c673cae FG |
1189 | }; |
1190 | map<dirfrag_t,fragment_info_t> fragments; | |
a8e16298 | 1191 | typedef map<dirfrag_t,fragment_info_t>::iterator fragment_info_iterator; |
7c673cae FG |
1192 | |
1193 | void adjust_dir_fragments(CInode *diri, frag_t basefrag, int bits, | |
11fdf7f2 | 1194 | list<CDir*>& frags, MDSContext::vec& waiters, bool replay); |
7c673cae FG |
1195 | void adjust_dir_fragments(CInode *diri, |
1196 | list<CDir*>& srcfrags, | |
1197 | frag_t basefrag, int bits, | |
1198 | list<CDir*>& resultfrags, | |
11fdf7f2 | 1199 | MDSContext::vec& waiters, |
7c673cae FG |
1200 | bool replay); |
1201 | CDir *force_dir_fragment(CInode *diri, frag_t fg, bool replay=true); | |
11fdf7f2 | 1202 | void get_force_dirfrag_bound_set(const vector<dirfrag_t>& dfs, set<CDir*>& bounds); |
7c673cae FG |
1203 | |
1204 | bool can_fragment(CInode *diri, list<CDir*>& dirs); | |
1205 | void fragment_freeze_dirs(list<CDir*>& dirs); | |
1206 | void fragment_mark_and_complete(MDRequestRef& mdr); | |
1207 | void fragment_frozen(MDRequestRef& mdr, int r); | |
1208 | void fragment_unmark_unfreeze_dirs(list<CDir*>& dirs); | |
a8e16298 TL |
1209 | void fragment_drop_locks(fragment_info_t &info); |
1210 | void fragment_maybe_finish(const fragment_info_iterator& it); | |
7c673cae FG |
1211 | void dispatch_fragment_dir(MDRequestRef& mdr); |
1212 | void _fragment_logged(MDRequestRef& mdr); | |
1213 | void _fragment_stored(MDRequestRef& mdr); | |
a8e16298 TL |
1214 | void _fragment_committed(dirfrag_t f, const MDRequestRef& mdr); |
1215 | void _fragment_old_purged(dirfrag_t f, int bits, const MDRequestRef& mdr); | |
7c673cae FG |
1216 | |
1217 | friend class EFragment; | |
1218 | friend class C_MDC_FragmentFrozen; | |
1219 | friend class C_MDC_FragmentMarking; | |
1220 | friend class C_MDC_FragmentPrep; | |
1221 | friend class C_MDC_FragmentStore; | |
1222 | friend class C_MDC_FragmentCommit; | |
a8e16298 | 1223 | friend class C_IO_MDC_FragmentPurgeOld; |
7c673cae | 1224 | |
11fdf7f2 TL |
1225 | void handle_fragment_notify(const MMDSFragmentNotify::const_ref &m); |
1226 | void handle_fragment_notify_ack(const MMDSFragmentNotifyAck::const_ref &m); | |
7c673cae | 1227 | |
11fdf7f2 | 1228 | void add_uncommitted_fragment(dirfrag_t basedirfrag, int bits, const frag_vec_t& old_frag, |
7c673cae FG |
1229 | LogSegment *ls, bufferlist *rollback=NULL); |
1230 | void finish_uncommitted_fragment(dirfrag_t basedirfrag, int op); | |
11fdf7f2 | 1231 | void rollback_uncommitted_fragment(dirfrag_t basedirfrag, frag_vec_t&& old_frags); |
a8e16298 TL |
1232 | |
1233 | ||
1234 | DecayCounter trim_counter; | |
1235 | ||
7c673cae | 1236 | public: |
11fdf7f2 TL |
1237 | void wait_for_uncommitted_fragment(dirfrag_t dirfrag, MDSContext *c) { |
1238 | ceph_assert(uncommitted_fragments.count(dirfrag)); | |
7c673cae FG |
1239 | uncommitted_fragments[dirfrag].waiters.push_back(c); |
1240 | } | |
1241 | void split_dir(CDir *dir, int byn); | |
1242 | void merge_dir(CInode *diri, frag_t fg); | |
1243 | void rollback_uncommitted_fragments(); | |
1244 | ||
1245 | void find_stale_fragment_freeze(); | |
1246 | void fragment_freeze_inc_num_waiters(CDir *dir); | |
1247 | bool fragment_are_all_frozen(CDir *dir); | |
1248 | int get_num_fragmenting_dirs() { return fragments.size(); } | |
1249 | ||
1250 | // -- updates -- | |
1251 | //int send_inode_updates(CInode *in); | |
1252 | //void handle_inode_update(MInodeUpdate *m); | |
1253 | ||
1254 | int send_dir_updates(CDir *in, bool bcast=false); | |
11fdf7f2 | 1255 | void handle_dir_update(const MDirUpdate::const_ref &m); |
7c673cae FG |
1256 | |
1257 | // -- cache expiration -- | |
11fdf7f2 TL |
1258 | void handle_cache_expire(const MCacheExpire::const_ref &m); |
1259 | // delayed cache expire | |
1260 | map<CDir*, expiremap> delayed_expire; // subtree root -> expire msg | |
7c673cae FG |
1261 | void process_delayed_expire(CDir *dir); |
1262 | void discard_delayed_expire(CDir *dir); | |
1263 | ||
1264 | protected: | |
11fdf7f2 | 1265 | int dump_cache(std::string_view fn, Formatter *f); |
7c673cae | 1266 | public: |
31f18b77 | 1267 | int dump_cache() { return dump_cache(NULL, NULL); } |
11fdf7f2 | 1268 | int dump_cache(std::string_view filename); |
31f18b77 | 1269 | int dump_cache(Formatter *f); |
11fdf7f2 | 1270 | void dump_tree(CInode *in, const int cur_depth, const int max_depth, Formatter *f); |
7c673cae | 1271 | |
f64942e4 | 1272 | void cache_status(Formatter *f); |
181888fb | 1273 | |
7c673cae FG |
1274 | void dump_resolve_status(Formatter *f) const; |
1275 | void dump_rejoin_status(Formatter *f) const; | |
1276 | ||
1277 | // == crap fns == | |
1278 | public: | |
1279 | void show_cache(); | |
81eedcae | 1280 | void show_subtrees(int dbl=10, bool force_print=false); |
7c673cae FG |
1281 | |
1282 | CInode *hack_pick_random_inode() { | |
11fdf7f2 | 1283 | ceph_assert(!inode_map.empty()); |
7c673cae | 1284 | int n = rand() % inode_map.size(); |
b32b8144 | 1285 | auto p = inode_map.begin(); |
7c673cae FG |
1286 | while (n--) ++p; |
1287 | return p->second; | |
1288 | } | |
1289 | ||
1290 | protected: | |
1291 | void flush_dentry_work(MDRequestRef& mdr); | |
1292 | /** | |
1293 | * Resolve path to a dentry and pass it onto the ScrubStack. | |
1294 | * | |
1295 | * TODO: return enough information to the original mdr formatter | |
1296 | * and completion that they can subsequeuntly check the progress of | |
1297 | * this scrub (we won't block them on a whole scrub as it can take a very | |
1298 | * long time) | |
1299 | */ | |
1300 | void enqueue_scrub_work(MDRequestRef& mdr); | |
11fdf7f2 | 1301 | void recursive_scrub_finish(const ScrubHeaderRef& header); |
7c673cae FG |
1302 | void repair_inode_stats_work(MDRequestRef& mdr); |
1303 | void repair_dirfrag_stats_work(MDRequestRef& mdr); | |
11fdf7f2 TL |
1304 | void upgrade_inode_snaprealm_work(MDRequestRef& mdr); |
1305 | friend class C_MDC_RespondInternalRequest; | |
7c673cae | 1306 | public: |
11fdf7f2 | 1307 | void flush_dentry(std::string_view path, Context *fin); |
7c673cae FG |
1308 | /** |
1309 | * Create and start an OP_ENQUEUE_SCRUB | |
1310 | */ | |
11fdf7f2 | 1311 | void enqueue_scrub(std::string_view path, std::string_view tag, |
7c673cae FG |
1312 | bool force, bool recursive, bool repair, |
1313 | Formatter *f, Context *fin); | |
1314 | void repair_inode_stats(CInode *diri); | |
1315 | void repair_dirfrag_stats(CDir *dir); | |
11fdf7f2 | 1316 | void upgrade_inode_snaprealm(CInode *in); |
7c673cae FG |
1317 | |
1318 | public: | |
1319 | /* Because exports may fail, this set lets us keep track of inodes that need exporting. */ | |
1320 | std::set<CInode *> export_pin_queue; | |
11fdf7f2 TL |
1321 | |
1322 | OpenFileTable open_file_table; | |
7c673cae FG |
1323 | }; |
1324 | ||
1325 | class C_MDS_RetryRequest : public MDSInternalContext { | |
1326 | MDCache *cache; | |
1327 | MDRequestRef mdr; | |
1328 | public: | |
1329 | C_MDS_RetryRequest(MDCache *c, MDRequestRef& r); | |
1330 | void finish(int r) override; | |
1331 | }; | |
1332 | ||
1333 | #endif |