]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon/PGMonitor.cc: return error instead of '0' from dump_stuck_pg_stats()
authorDanny Al-Gaaf <danny.al-gaaf@bisect.de>
Thu, 28 Jan 2016 10:26:39 +0000 (11:26 +0100)
committerDanny Al-Gaaf <danny.al-gaaf@bisect.de>
Fri, 29 Jan 2016 20:51:17 +0000 (21:51 +0100)
Fix for:

[src/mon/PGMonitor.cc:1667] -> [src/mon/PGMonitor.cc:1669]: (performance)
 Variable 'r' is reassigned a value before the old one has been used.

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
src/mon/PGMonitor.cc

index 98ffb8b5803846dae68c7f3bac59ad7f53c8753d..60ce45d49412654158c4f36daa73ba6847f28f3b 100644 (file)
@@ -1748,7 +1748,10 @@ bool PGMonitor::preprocess_command(MonOpRequestRef op)
                int64_t(g_conf->mon_pg_stuck_threshold));
 
     r = dump_stuck_pg_stats(ds, f.get(), (int)threshold, stuckop_vec);
-    ss << "ok";
+    if (r < 0)
+      ss << "failed";  
+    else 
+      ss << "ok";
     r = 0;
   } else if (prefix == "pg map") {
     pg_t pgid;
@@ -2437,7 +2440,7 @@ int PGMonitor::dump_stuck_pg_stats(stringstream &ds,
       stuck_types |= PGMap::STUCK_STALE;
     else {
       ds << "Unknown type: " << *i << std::endl;
-      return 0;
+      return -EINVAL;
     }
   }