]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: fix fragment thrasher
authorJohn Spray <john.spray@redhat.com>
Thu, 17 Nov 2016 23:19:33 +0000 (23:19 +0000)
committerJohn Spray <john.spray@redhat.com>
Thu, 24 Nov 2016 10:32:48 +0000 (10:32 +0000)
The allows_dirfrags() test was in the wrong place, causing
in some cases a root fragment to be passed into queue_merge.

Signed-off-by: John Spray <john.spray@redhat.com>
src/mds/MDSRank.cc

index 88359db69da7a7594050e43472ee199e22342b20..7a51ed02ad0a4cf2afa1e53535446a34988775a4 100644 (file)
@@ -520,11 +520,13 @@ bool MDSRank::_dispatch(Message *m, bool new_msg)
     if (!dir->get_parent_dir()) continue;    // must be linked.
     if (!dir->is_auth()) continue;           // must be auth.
     frag_t fg = dir->get_frag();
-    if (mdsmap->allows_dirfrags() &&
-       (fg == frag_t() || (rand() % (1 << fg.bits()) == 0)))
-      mdcache->split_dir(dir, 1);
-    else
-      balancer->queue_merge(dir);
+    if (mdsmap->allows_dirfrags()) {
+      if ((fg == frag_t() || (rand() % (1 << fg.bits()) == 0))) {
+        mdcache->split_dir(dir, 1);
+      } else {
+        balancer->queue_merge(dir);
+      }
+    }
   }
 
   // hack: force hash root?