From: liuchang0812 Date: Mon, 31 Jul 2017 03:06:58 +0000 (+0800) Subject: os/bluestore: clear result in BlueRocksEnv::getChildren X-Git-Tag: v12.1.3~24^2~11^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=3f5d51ac3c2035b4bd715f807fc210f8e00844fd;p=ceph.git os/bluestore: clear result in BlueRocksEnv::getChildren see https://github.com/facebook/rocksdb/blob/master/env/env_posix.cc#L492. in rocksdb::env_posix implementation, it will always clear result at first. We will get a core dump when we use rocksdb::RepairDB if we do not clear result. Fixes: http://tracker.ceph.com/issues/20857 Signed-off-by: liuchang0812 --- diff --git a/src/os/bluestore/BlueRocksEnv.cc b/src/os/bluestore/BlueRocksEnv.cc index 1b1e2e903572..34e8a2fea0b8 100644 --- a/src/os/bluestore/BlueRocksEnv.cc +++ b/src/os/bluestore/BlueRocksEnv.cc @@ -407,6 +407,7 @@ rocksdb::Status BlueRocksEnv::GetChildren( const std::string& dir, std::vector* result) { + result->clear(); int r = fs->readdir(dir, result); if (r < 0) return rocksdb::Status::IOError(dir, strerror(ENOENT));// return err_to_status(r);