From 20e6229cff667fd5487aab170c493397f9705c69 Mon Sep 17 00:00:00 2001 From: Matt Benjamin Date: Thu, 14 Mar 2019 13:58:17 -0400 Subject: [PATCH] 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 (cherry picked from commit a53e6c1d5b785a2a46007292041d0a8cb552e3e6) Conflicts: src/rgw/rgw_file.h : Resolved in operator --- src/rgw/rgw_file.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/rgw/rgw_file.h b/src/rgw/rgw_file.h index 63b5b9e242778..2f031e1a2124a 100644 --- a/src/rgw/rgw_file.h +++ b/src/rgw/rgw_file.h @@ -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; } -- 2.39.5