]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
rgw: nfs: skip empty (non-POSIX) path segments
authorMatt Benjamin <mbenjamin@redhat.com>
Thu, 14 Mar 2019 17:58:17 +0000 (13:58 -0400)
committerMatt Benjamin <mbenjamin@redhat.com>
Thu, 14 Mar 2019 18:03:33 +0000 (14:03 -0400)
Such a path could be created through S3 upload,
e.g., s3://my_files//data/file.pdf.

Previously we asserted for this case, but it's harmless--such a
path segment should just be ignored.

Fixes: http://tracker.ceph.com/issues/38744
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
src/rgw/rgw_file.h

index 82b2387b76d48235fd0c3a73a6233317252adb6f..bc695eb0d0b3d17c61dcf28755a854f06e2975fd 100644 (file)
@@ -1473,7 +1473,7 @@ public:
   int operator()(const boost::string_ref name, const rgw_obj_key& marker,
                uint8_t type) {
 
-    ceph_assert(name.length() > 0); // XXX
+    assert(name.length() > 0); // all cases handled in callers
 
     /* hash offset of name in parent (short name) for NFS readdir cookie */
     uint64_t off = XXH64(name.data(), name.length(), fh_key::seed);
@@ -1559,6 +1559,12 @@ public:
                             << " cpref=" << sref
                             << dendl;
 
+      if (sref.empty()) {
+       /* null path segment--could be created in S3 but has no NFS
+        * interpretation */
+       return;
+      }
+
       this->operator()(sref, next_marker, RGW_FS_TYPE_DIRECTORY);
       ++ix;
     }