mds: check projected parent to avoid unsafe access

An anonymous inode may not have a stable parent so immediate migration would
cause a segfault when checking for strays.

Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
This commit is contained in:
Patrick Donnelly 2017-04-17 22:33:19 -04:00
parent b2f53b85c3
commit 26a08f31f7
No known key found for this signature in database
GPG Key ID: 3A2A7E25BEA8AADB

View File

@ -781,7 +781,7 @@ void Migrator::export_dir(CDir *dir, mds_rank_t dest)
return;
}
if (!dir->inode->is_base() && dir->get_parent_dir()->get_inode()->is_stray() &&
if (!dir->inode->is_base() && dir->get_inode()->get_projected_parent_dir()->get_inode()->is_stray() &&
dir->get_parent_dir()->get_parent_dir()->ino() != MDS_INO_MDSDIR(dest)) {
dout(7) << "i won't export anything in stray" << dendl;
return;