From: Sage Weil Date: Wed, 3 Oct 2012 16:12:40 +0000 (-0700) Subject: mds: make migrate_stray() specify full path X-Git-Tag: v0.54~124^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=2de5670583d8871f42f858343d1f8cdaf627f917;p=ceph.git mds: make migrate_stray() specify full path The handle_client_rename() check expects a full path rooted in the MDSDIR. Do so in migrate_stray(). Also, use the committed (not projected) dn linkage; this was a carry-over from the original switch to this API forever ago, but the current callers don't need to migrate an uncommitted stray. This also aligns us with reintegrate_stray(). Reported-by: Yan, Zheng Signed-off-by: Sage Weil --- diff --git a/src/mds/MDCache.cc b/src/mds/MDCache.cc index 3b1dc2efea75..8598f46dba57 100644 --- a/src/mds/MDCache.cc +++ b/src/mds/MDCache.cc @@ -8306,16 +8306,20 @@ void MDCache::reintegrate_stray(CDentry *straydn, CDentry *rdn) void MDCache::migrate_stray(CDentry *dn, int to) { - CInode *fromino = dn->dir->get_inode(); - dout(10) << "migrate_stray from mds" - << MDS_INO_STRAY_OWNER(fromino->inode.ino) << " to mds." << to - << " " << *dn << " " << *dn->get_projected_linkage()->get_inode() << dendl; + CInode *in = dn->get_linkage()->get_inode(); + assert(in); + CInode *diri = dn->dir->get_inode(); + assert(diri->is_stray()); + dout(10) << "migrate_stray from mds." << MDS_INO_STRAY_OWNER(diri->inode.ino) + << " to mds." << to + << " " << *dn << " " << *in << dendl; // rename it to another mds. - string dname; - dn->get_projected_linkage()->get_inode()->name_stray_dentry(dname); + filepath src; + dn->make_path(src); - filepath src(dname, fromino->inode.ino); + string dname; + in->name_stray_dentry(dname); filepath dst(dname, MDS_INO_STRAY(to, 0)); MClientRequest *req = new MClientRequest(CEPH_MDS_OP_RENAME);