]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
tools/cephfs: set dir_layout when injecting inodes 14574/head
authorJohn Spray <john.spray@redhat.com>
Wed, 29 Mar 2017 18:38:37 +0000 (19:38 +0100)
committerNathan Cutler <ncutler@suse.com>
Fri, 14 Apr 2017 22:00:16 +0000 (00:00 +0200)
When we left this as zero, the MDS would interpret it was HASH_LINUX
rather than the default HASH_RJENKINS.  Potentially that
could cause problems if there perhaps were already dirfrags in
the metadata pool that were set up using rjenkins.  Mainly
it just seems more appropriate to explicitly set this field
rather than hit the fallback behaviour.

Related: http://tracker.ceph.com/issues/19406
Signed-off-by: John Spray <john.spray@redhat.com>
(cherry picked from commit 7d6d542885bd29b71214f9ca52bd26e9183c5d01)

src/tools/cephfs/DataScan.cc

index 7ff86ef3c202cd1ab98acb2e5a7a63e2b34b98c4..442e78a538321cfd4f8e2f614e88296ab76873d2 100644 (file)
@@ -354,6 +354,7 @@ int MetadataDriver::inject_unlinked_inode(
   // they don't have to mount the filesystem to correct it?
   inode.inode.layout = file_layout_t::get_default();
   inode.inode.layout.pool_id = data_pool_id;
+  inode.inode.dir_layout.dl_dir_hash = g_conf->mds_default_dir_hash;
 
   // Assume that we will get our stats wrong, and that we may
   // be ignoring dirfrags that exist
@@ -1626,6 +1627,8 @@ int MetadataDriver::inject_with_backtrace(
         // accurate, but it should avoid functional issues.
 
         ancestor_dentry.inode.dirstat.nfiles = 1;
+        ancestor_dentry.inode.dir_layout.dl_dir_hash =
+                                               g_conf->mds_default_dir_hash;
 
         ancestor_dentry.inode.nlink = 1;
         ancestor_dentry.inode.ino = ino;
@@ -1967,6 +1970,7 @@ void MetadataTool::build_dir_dentry(
   out->inode.ctime.tv.tv_sec = fragstat.mtime;
 
   out->inode.layout = layout;
+  out->inode.dir_layout.dl_dir_hash = g_conf->mds_default_dir_hash;
 
   out->inode.truncate_seq = 1;
   out->inode.truncate_size = -1ull;