Merge pull request #15205 from batrick/i20039

mds: check export pin during replay

Reviewed-by: Yan, Zheng <zyan@redhat.com>
This commit is contained in:
John Spray 2017-06-01 11:23:02 +01:00 committed by GitHub
commit 01c46bf832
4 changed files with 7 additions and 8 deletions

View File

@ -13,9 +13,8 @@ class TestExports(CephFSTestCase):
for i in range(timeout/pause):
subtrees = self.fs.mds_asok(["get", "subtrees"], mds_id=status.get_rank(self.fs.id, rank)['name'])
subtrees = filter(lambda s: s['dir']['path'].startswith('/'), subtrees)
log.info(subtrees)
filtered = sorted([(s['dir']['path'], s['auth_first']) for s in subtrees])
log.info(filtered)
log.info("%s =?= %s", filtered, test)
if filtered == test:
return subtrees
time.sleep(pause)

View File

@ -1068,9 +1068,8 @@ public:
projected_parent.pop_front();
}
private:
void maybe_export_pin(bool update=false);
public:
void maybe_export_pin(bool update=false);
void set_export_pin(mds_rank_t rank);
mds_rank_t get_export_pin(bool inherit=true) const;
bool is_exportable(mds_rank_t dest) const;

View File

@ -755,11 +755,11 @@ void Migrator::get_export_lock_set(CDir *dir, set<SimpleLock*>& locks)
}
class C_M_ExportTargetWait : public MigratorContext {
class C_M_ExportDirWait : public MigratorContext {
MDRequestRef mdr;
int count;
public:
C_M_ExportTargetWait(Migrator *m, MDRequestRef mdr, int count)
C_M_ExportDirWait(Migrator *m, MDRequestRef mdr, int count)
: MigratorContext(m), mdr(mdr), count(count) {}
void finish(int r) override {
mig->dispatch_export_dir(mdr, count);
@ -884,13 +884,13 @@ void Migrator::dispatch_export_dir(MDRequestRef& mdr, int count)
export_try_cancel(dir);
return;
}
mds->wait_for_mdsmap(mds->mdsmap->get_epoch(), new C_M_ExportTargetWait(this, mdr, count+1));
mds->wait_for_mdsmap(mds->mdsmap->get_epoch(), new C_M_ExportDirWait(this, mdr, count+1));
return;
}
if (!dir->inode->get_parent_dn()) {
dout(7) << "waiting for dir to become stable before export: " << *dir << dendl;
dir->add_waiter(CDir::WAIT_CREATED, new C_M_ExportTargetWait(this, mdr, 1));
dir->add_waiter(CDir::WAIT_CREATED, new C_M_ExportDirWait(this, mdr, 1));
return;
}

View File

@ -549,6 +549,7 @@ void EMetaBlob::fullbit::update_inode(MDSRank *mds, CInode *in)
{
in->inode = inode;
in->xattrs = xattrs;
in->maybe_export_pin();
if (in->inode.is_dir()) {
if (!(in->dirfragtree == dirfragtree)) {
dout(10) << "EMetaBlob::fullbit::update_inode dft " << in->dirfragtree << " -> "