From: Matt Benjamin Date: Tue, 12 Jan 2016 18:04:27 +0000 (-0500) Subject: librgw: ignore "/" as a common_prefix X-Git-Tag: v10.1.0~382^2~38 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=998ed65d50f5cf97dc41fec124721a884ca1a9e5;p=ceph.git librgw: ignore "/" as a common_prefix This happens commonly, apparently when a parent object name ends with '/' (as all explicit directories do). Signed-off-by: Matt Benjamin --- diff --git a/src/rgw/rgw_file.h b/src/rgw/rgw_file.h index aac73446085ca..5df33e4ba073d 100644 --- a/src/rgw/rgw_file.h +++ b/src/rgw/rgw_file.h @@ -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 */