assert(!state_test(STATE_COMMITTING));
fnode = got_fnode;
projected_version = committing_version = committed_version = got_fnode.version;
+
+ if (state_test(STATE_REJOINUNDEF)) {
+ assert(cache->mds->is_rejoin());
+ state_clear(STATE_REJOINUNDEF);
+ cache->opened_undef_dirfrag(this);
+ }
}
// purge stale snaps?
static const int STATE_ANCHORING = (1<<3);
static const int STATE_UNANCHORING = (1<<4);
static const int STATE_OPENINGDIR = (1<<5);
- static const int STATE_REJOINUNDEF = (1<<6); // inode contents undefined.
static const int STATE_FREEZING = (1<<7);
static const int STATE_FROZEN = (1<<8);
static const int STATE_AMBIGUOUSAUTH = (1<<9);
}
assert(in->is_dir());
CDir *dir = in->get_or_open_dirfrag(this, df.frag);
+ dir->state_set(CDir::STATE_REJOINUNDEF);
+ rejoin_undef_dirfrags.insert(dir);
dout(10) << " invented " << *dir << dendl;
return dir;
}
assert(reconnected_snaprealms.empty());
dout(10) << "open_snap_parents - all open" << dendl;
do_delayed_cap_imports();
- start_files_to_recover(rejoin_recover_q, rejoin_check_q);
+ open_undef_dirfrags();
+ }
+}
+
+struct C_MDC_OpenUndefDirfragsFinish : public Context {
+ MDCache *cache;
+ C_MDC_OpenUndefDirfragsFinish(MDCache *c) : cache(c) {}
+ void finish(int r) {
+ cache->open_undef_dirfrags();
+ }
+};
+
+void MDCache::open_undef_dirfrags()
+{
+ dout(10) << "open_undef_dirfrags " << rejoin_undef_dirfrags.size() << " dirfrags" << dendl;
+
+ C_Gather *gather = 0;
+ for (set<CDir*>::iterator p = rejoin_undef_dirfrags.begin();
+ p != rejoin_undef_dirfrags.end();
+ p++) {
+ CDir *dir = *p;
+ if (!gather)
+ gather = new C_Gather(new C_MDC_OpenUndefDirfragsFinish(this));
+ dir->fetch(gather->new_sub());
+ }
+
+ if (rejoin_undef_dirfrags.empty()) {
+ assert(!gather);
+
+ start_files_to_recover(rejoin_recover_q, rejoin_check_q);
+
mds->queue_waiters(rejoin_waiters);
mds->rejoin_done();
set<CInode*> rejoin_undef_inodes;
set<CInode*> rejoin_potential_updated_scatterlocks;
+ set<CDir*> rejoin_undef_dirfrags;
vector<CInode*> rejoin_recover_q, rejoin_check_q;
list<Context*> rejoin_waiters;
void check_realm_past_parents(SnapRealm *realm);
void open_snap_parents();
+ void open_undef_dirfrags();
+ void opened_undef_dirfrag(CDir *dir) {
+ rejoin_undef_dirfrags.erase(dir);
+ }
+
void reissue_all_caps();
const static int STATE_AUTH = (1<<30);
const static int STATE_DIRTY = (1<<29);
const static int STATE_REJOINING = (1<<28); // replica has not joined w/ primary copy
+ const static int STATE_REJOINUNDEF = (1<<27); // contents undefined.
+
// -- wait --
const static uint64_t WAIT_SINGLEAUTH = (1ull<<60);