From: Patrick Donnelly Date: Sat, 7 Mar 2020 03:19:49 +0000 (-0800) Subject: mds: skip export of empty directories X-Git-Tag: v15.2.5~172^2~16 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=b860823d70a7c6081d73e46be8dda454f30669ad;p=ceph.git mds: skip export of empty directories Note: empty as in no cached sub-entries. Signed-off-by: Patrick Donnelly (cherry picked from commit 570e6cfbcfc98f877a0e21cf536dfc826a4f9d15) --- diff --git a/src/mds/MDBalancer.cc b/src/mds/MDBalancer.cc index 89f4040fa2c..c3bac659ecf 100644 --- a/src/mds/MDBalancer.cc +++ b/src/mds/MDBalancer.cc @@ -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; } }