]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-mon: check fs stats just before preforking 2656/head
authorJoao Eduardo Luis <joao@redhat.com>
Tue, 23 Sep 2014 13:02:55 +0000 (14:02 +0100)
committerSage Weil <sage@redhat.com>
Thu, 16 Oct 2014 00:18:42 +0000 (17:18 -0700)
Otherwise statfs may fail if mkfs hasn't been run yet or if the monitor
data directory does not exist.  There are checks to account for the mon
data dir not existing and we should wait for them to clear before we go
ahead and check the fs stats.

Signed-off-by: Joao Eduardo Luis <joao@redhat.com>
(cherry picked from commit 7f71c11666b25e91dd612c58b4eda9ac0d4752f8)

Conflicts:
src/ceph_mon.cc

src/ceph_mon.cc

index 5d762a97c443b2b4ba17b142e22fe43120ff4050..1b52f58845259ffcba1c8bac71e0caed3a9aab1f 100644 (file)
@@ -293,26 +293,6 @@ int main(int argc, const char **argv)
     exit(0);
   }
 
-  {
-    // check fs stats. don't start if it's critically close to full.
-    ceph_data_stats_t stats;
-    int err = get_fs_stats(stats, g_conf->mon_data.c_str());
-    if (err < 0) {
-      cerr << "error checking monitor data's fs stats: " << cpp_strerror(err)
-           << std::endl;
-      exit(-err);
-    }
-    if (stats.avail_percent <= g_conf->mon_data_avail_crit) {
-      cerr << "error: monitor data filesystem reached concerning levels of"
-           << " available storage space (available: "
-           << stats.avail_percent << "% " << prettybyte_t(stats.byte_avail)
-           << ")\nyou may adjust 'mon data avail crit' to a lower value"
-           << " to make this go away (default: " << g_conf->mon_data_avail_crit
-           << "%)\n" << std::endl;
-      exit(ENOSPC);
-    }
-  }
-
   // -- mkfs --
   if (mkfs) {
 
@@ -439,6 +419,26 @@ int main(int argc, const char **argv)
     return 0;
   }
 
+  {
+    // check fs stats. don't start if it's critically close to full.
+    ceph_data_stats_t stats;
+    int err = get_fs_stats(stats, g_conf->mon_data.c_str());
+    if (err < 0) {
+      cerr << "error checking monitor data's fs stats: " << cpp_strerror(err)
+           << std::endl;
+      exit(-err);
+    }
+    if (stats.avail_percent <= g_conf->mon_data_avail_crit) {
+      cerr << "error: monitor data filesystem reached concerning levels of"
+           << " available storage space (available: "
+           << stats.avail_percent << "% " << prettybyte_t(stats.byte_avail)
+           << ")\nyou may adjust 'mon data avail crit' to a lower value"
+           << " to make this go away (default: " << g_conf->mon_data_avail_crit
+           << "%)\n" << std::endl;
+      exit(ENOSPC);
+    }
+  }
+
   // we fork early to prevent leveldb's environment static state from
   // screwing us over
   Preforker prefork;