]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: fix race between StrayManager::{eval_stray,reintegrate_stray} 9559/head
authorYan, Zheng <zyan@redhat.com>
Mon, 23 May 2016 09:40:05 +0000 (17:40 +0800)
committerAbhishek Varshney <abhishek.varshney@flipkart.com>
Tue, 7 Jun 2016 14:37:36 +0000 (20:07 +0530)
StrayManager::eval_stray() is called after Server::respond_to_request()
drops locks. So it can race with StrayManager::reintegrate_stray()

Fixes: http://tracker.ceph.com/issues/15920
Signed-off-by: Yan, Zheng <zyan@redhat.com>
(cherry picked from commit 65827a0fd4d4ecb6d5e2eccf3a1818026ce1f10c)

src/mds/Server.cc

index 750fb418cef48086229e5beccf5622ee8f9d2270..d41661a9a28cd51d2af2e0005ebcc84ff27bf26b 100644 (file)
@@ -5569,8 +5569,9 @@ void Server::_unlink_local_finish(MDRequestRef& mdr,
   // removing a new dn?
   dn->get_dir()->try_remove_unlinked_dn(dn);
 
-  // clean up?
-  if (straydn) {
+  // clean up ?
+  // respond_to_request() drops locks. So stray reintegration can race with us.
+  if (straydn && !straydn->get_projected_linkage()->is_null()) {
     // Tip off the MDCache that this dentry is a stray that
     // might be elegible for purge.
     mdcache->notify_stray(straydn);
@@ -6417,7 +6418,8 @@ void Server::_rename_finish(MDRequestRef& mdr, CDentry *srcdn, CDentry *destdn,
     mds->locker->eval(in, CEPH_CAP_LOCKS, true);
 
   // clean up?
-  if (straydn) {
+  // respond_to_request() drops locks. So stray reintegration can race with us.
+  if (straydn && !straydn->get_projected_linkage()->is_null()) {
     mdcache->notify_stray(straydn);
   }
 }