]> git.apps.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>
Wed, 24 Jun 2020 22:43:30 +0000 (15:43 -0700)
Note: empty as in no cached sub-entries.

Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
src/mds/MDBalancer.cc

index f7520070452588973b80a087130659302a1874bb..e4de95ec0f46551a50c644bdbeeb8ebaf6ac82fa 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;
       }
     }