]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
librgw: ignore "/" as a common_prefix
authorMatt Benjamin <mbenjamin@redhat.com>
Tue, 12 Jan 2016 18:04:27 +0000 (13:04 -0500)
committerMatt Benjamin <mbenjamin@redhat.com>
Fri, 12 Feb 2016 17:07:56 +0000 (12:07 -0500)
This happens commonly, apparently when a parent object name ends
with '/' (as all explicit directories do).

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
src/rgw/rgw_file.h

index aac73446085ca9a5062747551c6287390332ea69..5df33e4ba073d301534937899f856488962e6c16 100644 (file)
@@ -967,13 +967,15 @@ public:
 
   int operator()(const boost::string_ref name, const boost::string_ref marker,
                uint8_t type) {
+
+    assert(name.length() > 0); // XXX
+
     /* hash offset of name in parent (short name) for NFS readdir cookie */
-    std::string sname{name};
     uint64_t off = XXH64(name.data(), name.length(), fh_key::seed);
     *offset = off;
     /* update traversal cache */
     rgw_fh->add_marker(off, marker, type);
-    rcb(name.data(), cb_arg, off);
+    rcb(name.data(), cb_arg, off); // XXX has to be legit C-style string
     return 0;
   }
 
@@ -1020,6 +1022,10 @@ public:
                             << " iter second: " << iter.second
                             << dendl;
 
+      /* XXX aieee--I have seen this case! */
+      if (iter.first == "/")
+       continue;
+
       /* it's safest to modify the element in place--a suffix-modifying
        * string_ref operation is problematic since ULP rgw_file callers
        * will ultimately need a c-string */