]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: skip export of empty directories
authorPatrick Donnelly <pdonnell@redhat.com>
Sat, 7 Mar 2020 03:19:49 +0000 (19:19 -0800)
committerPatrick Donnelly <pdonnell@redhat.com>
Thu, 2 Jul 2020 00:19:53 +0000 (17:19 -0700)
Note: empty as in no cached sub-entries.

Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
(cherry picked from commit 570e6cfbcfc98f877a0e21cf536dfc826a4f9d15)

src/mds/MDBalancer.cc

index 89f4040fa2c83aaeeb876c10bdf607b47e5d1cbf..c3bac659ecf1d547f3a1f11082c346bc32d2eb4e 100644 (file)
@@ -145,7 +145,12 @@ void MDBalancer::handle_export_pins(void)
          dir->state_set(CDir::STATE_AUXSUBTREE);
        }
       } else {
-       mds->mdcache->migrator->export_dir(dir, export_pin);
+        /* Only export a directory if it's non-empty. An empty directory will
+         * be sent back by the importer.
+         */
+        if (dir->get_num_head_items() > 0) {
+         mds->mdcache->migrator->export_dir(dir, export_pin);
+        }
        remove = false;
       }
     }