From eea9803a3ff79f87b796c55c0b7285c501ff6c8b Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Fri, 24 Oct 2014 21:23:19 -0700 Subject: [PATCH] os/LevelDBStore, RocksDBStore: fix race handling for get store size If we get ENOENT, skip this file, instead of adding in undefined stat values. Backport: firefly Signed-off-by: Sage Weil --- src/os/LevelDBStore.h | 5 ++++- src/os/RocksDBStore.h | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/os/LevelDBStore.h b/src/os/LevelDBStore.h index 3dbc0f92dfd6..4617c5ca29a8 100644 --- a/src/os/LevelDBStore.h +++ b/src/os/LevelDBStore.h @@ -341,7 +341,10 @@ public: // happen when those files are being updated, data is being shuffled // and files get removed, in which case there's not much of a problem // as we'll get to them next time around. - if ((err < 0) && (err != -ENOENT)) { + if (err == -ENOENT) { + continue; + } + if (err < 0) { lderr(cct) << __func__ << " error obtaining stats for " << fpath << ": " << cpp_strerror(err) << dendl; goto err; diff --git a/src/os/RocksDBStore.h b/src/os/RocksDBStore.h index 318f259bcbf4..5c3160f5c99a 100644 --- a/src/os/RocksDBStore.h +++ b/src/os/RocksDBStore.h @@ -285,7 +285,10 @@ public: // happen when those files are being updated, data is being shuffled // and files get removed, in which case there's not much of a problem // as we'll get to them next time around. - if ((err < 0) && (err != -ENOENT)) { + if (err == -ENOENT) { + continue; + } + if (err < 0) { lderr(cct) << __func__ << " error obtaining stats for " << fpath << ": " << cpp_strerror(err) << dendl; goto err; -- 2.47.3