]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
os: LevelDBStore: ignore ENOENT files when estimating store size 561/head
authorJoao Eduardo Luis <jecluis@gmail.com>
Fri, 30 Aug 2013 17:05:33 +0000 (18:05 +0100)
committerJoao Eduardo Luis <jecluis@gmail.com>
Fri, 30 Aug 2013 17:05:33 +0000 (18:05 +0100)
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>
src/os/LevelDBStore.h

index 356ee59aa278db9ca31b75d8eccb2271be7c056b..89718ce19875953a2544645021353a12c755c810 100644 (file)
@@ -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;