]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: make migrate_stray() specify full path
authorSage Weil <sage@inktank.com>
Wed, 3 Oct 2012 16:12:40 +0000 (09:12 -0700)
committerSage Weil <sage@inktank.com>
Wed, 3 Oct 2012 16:12:40 +0000 (09:12 -0700)
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 <zheng.z.yan@intel.com>
Signed-off-by: Sage Weil <sage@inktank.com>
src/mds/MDCache.cc

index 3b1dc2efea75eb996b9d4567c53c52478754b914..8598f46dba57c93839934d17cf5b6062473489b7 100644 (file)
@@ -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);