16.1.0 RC (ceph-16.1.0-944-ge53ee8bd plus fix trailing slash bluestore)

Signed-off-by: Kaleb S. KEITHLEY <kkeithle@redhat.com>
This commit is contained in:
Kaleb S. KEITHLEY 2021-03-23 13:51:40 -04:00
parent c4b36fdbe9
commit 03686a5492

View File

@ -23,17 +23,35 @@ diff --git a/src/os/bluestore/BlueFS.cc b/src/os/bluestore/BlueFS.cc
index ea39626aef..62b9d27f58 100644 index ea39626aef..62b9d27f58 100644
--- a/src/os/bluestore/BlueFS.cc --- a/src/os/bluestore/BlueFS.cc
+++ b/src/os/bluestore/BlueFS.cc +++ b/src/os/bluestore/BlueFS.cc
@@ -3493,6 +3493,10 @@ @@ -3493,9 +3493,14 @@
int BlueFS::readdir(const string& dirname, vector<string> *ls) int BlueFS::readdir(const string& dirname, vector<string> *ls)
{ {
+ std::string dname = dirname;
+ // dirname may contain a trailing / + // dirname may contain a trailing /
+ if (!dirname.empty() && dirname.back() == '/') { + if (!dname.empty() && dname.back() == '/') {
+ dirname.remove_suffix(1); + dname.pop_back();
+ } + }
std::lock_guard l(lock); std::lock_guard l(lock);
dout(10) << __func__ << " " << dirname << dendl; - dout(10) << __func__ << " " << dirname << dendl;
if (dirname.empty()) { - if (dirname.empty()) {
+ dout(10) << __func__ << " " << dname << dendl;
+ if (dname.empty()) {
// list dirs
ls->reserve(dir_map.size() + 2);
for (auto& q : dir_map) {
@@ -3503,9 +3508,9 @@
}
} else {
// list files in dir
- map<string,DirRef>::iterator p = dir_map.find(dirname);
+ map<string,DirRef>::iterator p = dir_map.find(dname);
if (p == dir_map.end()) {
- dout(20) << __func__ << " dir " << dirname << " not found" << dendl;
+ dout(20) << __func__ << " dir " << dname << " not found" << dendl;
return -ENOENT;
}
DirRef dir = p->second;
-- --
2.26.2 2.26.2