If we are importing the renamed inode, and it is a directory, journal a
list of all open dirfrags (currently, this is actually all frags) so that
we can open them up during journal replay.
Signed-off-by: Sage Weil <sage.weil@dreamhost.com>
version_t oldpv;
if (srcdn->is_auth())
oldpv = srci->get_projected_version();
- else
+ else {
oldpv = _rename_prepare_import(mdr, srcdn, client_map_bl);
+
+ // note which dirfrags have child subtrees in the journal
+ // event, so that we can open those (as bounds) during replay.
+ if (srci->is_dir()) {
+ list<CDir*> ls;
+ srci->get_dirfrags(ls);
+ for (list<CDir*>::iterator p = ls.begin(); p != ls.end(); ++p) {
+ CDir *dir = *p;
+ metablob->renamed_dir_frags.push_back(dir->get_frag());
+ }
+ dout(10) << " noting renamed dir open frags " << metablob->renamed_dir_frags << dendl;
+ }
+ }
pi = srci->project_inode(); // project snaprealm if srcdnl->is_primary
// & srcdnl->snaprealm
pi->version = mdr->more()->pvmap[destdn] = destdn->pre_dirty(oldpv);
inodeno_t opened_ino;
public:
inodeno_t renamed_dirino;
+ list<frag_t> renamed_dir_frags;
private:
// ino (pre)allocation. may involve both inotable AND session state.
::encode(destroyed_inodes, bl);
::encode(client_reqs, bl);
::encode(renamed_dirino, bl);
+ ::encode(renamed_dir_frags, bl);
}
void decode(bufferlist::iterator &bl) {
__u8 struct_v;
r.pop_front();
}
}
- if (struct_v >= 3)
+ if (struct_v >= 3) {
::decode(renamed_dirino, bl);
+ ::decode(renamed_dir_frags, bl);
+ }
}