]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: refuse to start if configure object limits don't work
authorSage Weil <sage@redhat.com>
Tue, 12 Apr 2016 15:00:33 +0000 (11:00 -0400)
committerSage Weil <sage@redhat.com>
Fri, 15 Apr 2016 13:05:49 +0000 (09:05 -0400)
Fail early if the configured max object name cannot be stored on
the (FileStore) backend.  This avoids rude surprises down the
line when some random rados op get ENAMETOOLONG.

Signed-off-by: Sage Weil <sage@redhat.com>
src/osd/OSD.cc

index 7c260ff39aeae99b023af98aad36bb1674af586d..b37134114e34e6db45da9239a611c17dfd6d590b 100644 (file)
@@ -2022,6 +2022,25 @@ int OSD::init()
   int rotating_auth_attempts = 0;
   const int max_rotating_auth_attempts = 10;
 
+  // sanity check long object name handling
+  {
+    hobject_t l;
+    l.oid.name = string(g_conf->osd_max_object_name_len, 'n');
+    l.set_key(string(g_conf->osd_max_object_name_len, 'k'));
+    l.nspace = string(g_conf->osd_max_object_namespace_len, 's');
+    r = store->validate_hobject_key(l);
+    if (r < 0) {
+      derr << "backend (" << store->get_type() << ") is unable to support max "
+          << "object name[space] len" << dendl;
+      derr << "   osd max object name len = "
+          << g_conf->osd_max_object_name_len << dendl;
+      derr << "   osd max object namespace len = "
+          << g_conf->osd_max_object_namespace_len << dendl;
+      derr << cpp_strerror(r) << dendl;
+      goto out;
+    }
+  }
+
   // read superblock
   r = read_superblock();
   if (r < 0) {