diff --git a/src/os/filestore/FileStore.cc b/src/os/filestore/FileStore.cc index 2c5c6bd7dbb95..21b8230718a17 100644 --- a/src/os/filestore/FileStore.cc +++ b/src/os/filestore/FileStore.cc @@ -4575,6 +4575,7 @@ int FileStore::_collection_remove_recursive(const coll_t &cid, if (r < 0) return r; } + objects.clear(); } return _destroy_collection(cid); } @@ -4771,7 +4772,7 @@ int FileStore::collection_list(const coll_t& c, ghobject_t start, ghobject_t end assert(!m_filestore_fail_eio || r != -EIO); return r; } - dout(20) << "objects: " << ls << dendl; + dout(20) << "objects: " << *ls << dendl; // HashIndex doesn't know the pool when constructing a 'next' value if (next && !next->is_max()) { diff --git a/src/os/filestore/HashIndex.cc b/src/os/filestore/HashIndex.cc index a358ef3a8146c..b1bf7024fd218 100644 --- a/src/os/filestore/HashIndex.cc +++ b/src/os/filestore/HashIndex.cc @@ -550,7 +550,12 @@ int HashIndex::recursive_create_path(vector& path, int level) } int HashIndex::recursive_remove(const vector &path) { + return _recursive_remove(path, true); +} + +int HashIndex::_recursive_remove(const vector &path, bool top) { vector subdirs; + dout(20) << __func__ << " path=" << path << dendl; int r = list_subdirs(path, &subdirs); if (r < 0) return r; @@ -565,12 +570,15 @@ int HashIndex::recursive_remove(const vector &path) { i != subdirs.end(); ++i) { subdir.push_back(*i); - r = recursive_remove(subdir); + r = _recursive_remove(subdir, false); if (r < 0) return r; subdir.pop_back(); } - return remove_path(path); + if (top) + return 0; + else + return remove_path(path); } int HashIndex::start_col_split(const vector &path) { diff --git a/src/os/filestore/HashIndex.h b/src/os/filestore/HashIndex.h index d4222f912fa9a..461eddcac9366 100644 --- a/src/os/filestore/HashIndex.h +++ b/src/os/filestore/HashIndex.h @@ -198,6 +198,11 @@ class HashIndex : public LFNIndex { ghobject_t *next ); private: + /// Internal recursively remove path and its subdirs + int _recursive_remove( + const vector &path, ///< [in] path to remove + bool top ///< [in] internal tracking of first caller + ); /// @return Error Code, 0 on success /// Recursively remove path and its subdirs int recursive_remove( const vector &path ///< [in] path to remove