From: Matt Benjamin Date: Thu, 14 Mar 2019 17:58:17 +0000 (-0400) Subject: rgw: nfs: skip empty (non-POSIX) path segments X-Git-Tag: v15.0.0~227^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F26954%2Fhead;p=ceph.git rgw: nfs: skip empty (non-POSIX) path segments 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 --- diff --git a/src/rgw/rgw_file.h b/src/rgw/rgw_file.h index 82b2387b76d4..bc695eb0d0b3 100644 --- a/src/rgw/rgw_file.h +++ b/src/rgw/rgw_file.h @@ -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; }