diff options
author | Joao Eduardo Luis <jecluis@gmail.com> | 2013-08-30 18:05:33 +0100 |
---|---|---|
committer | Joao Eduardo Luis <jecluis@gmail.com> | 2013-08-30 18:05:33 +0100 |
commit | 64774e5792f136df2bc78db686440fc2f3a7643f (patch) | |
tree | 56afd26c16631ff2b713300974eb2667fdb204f5 | |
parent | 56ff4101a12e190caea9805dd5fb250ab5fa8e8c (diff) | |
download | ceph-64774e5792f136df2bc78db686440fc2f3a7643f.tar.gz |
os: LevelDBStore: ignore ENOENT files when estimating store size
While iterating over the store files we race against leveldb, which may
be shuffling data around thus removing some files.
By ignoring missing files on stat, we'll get to not account those files
but that's okay -- this is just an estimate.
Fixes: #6178
Signed-off-by: Joao Eduardo Luis <jecluis@gmail.com>
-rw-r--r-- | src/os/LevelDBStore.h | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/os/LevelDBStore.h b/src/os/LevelDBStore.h index 356ee59aa27..89718ce1987 100644 --- a/src/os/LevelDBStore.h +++ b/src/os/LevelDBStore.h @@ -329,7 +329,11 @@ public: string fpath = path + '/' + n; struct stat s; int err = stat(fpath.c_str(), &s); - if (err < 0) { + // we may race against leveldb while reading files; this should only + // 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)) { lderr(cct) << __func__ << " error obtaining stats for " << fpath << ": " << cpp_strerror(errno) << dendl; goto err; |