]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: nfs: skip empty (non-POSIX) path segments 27179/head
authorMatt Benjamin <mbenjamin@redhat.com>
Thu, 14 Mar 2019 17:58:17 +0000 (13:58 -0400)
committerPrashant D <pdhange@redhat.com>
Tue, 26 Mar 2019 02:17:27 +0000 (22:17 -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>
(cherry picked from commit a53e6c1d5b785a2a46007292041d0a8cb552e3e6)

Conflicts:
src/rgw/rgw_file.h : Resolved in operator

src/rgw/rgw_file.h

index 63b5b9e2427783b166703746907fde69e916c1ac..2f031e1a2124a4e29ba4ae2352fd5d047278088c 100644 (file)
@@ -1442,7 +1442,7 @@ public:
   int operator()(const boost::string_ref name, const rgw_obj_key& marker,
                uint8_t type) {
 
-    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);
@@ -1528,6 +1528,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;
     }