]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
Journaler: return errors from probing back to callers.
authorGreg Farnum <gregory.farnum@dreamhost.com>
Wed, 20 Jul 2011 21:30:16 +0000 (14:30 -0700)
committerGreg Farnum <gregory.farnum@dreamhost.com>
Wed, 20 Jul 2011 22:58:40 +0000 (15:58 -0700)
Adjust Dumper to handle the error codes. The other callers already do
so!

Signed-off-by: Greg Farnum <gregory.farnum@dreamhost.com>
src/mds/Dumper.cc
src/osdc/Journaler.cc

index af08f3786b459e8cb9172cb71f47dd3c6373c407..05fcbbd577697614c0a93a17952c91d66a874a8f 100644 (file)
@@ -84,15 +84,24 @@ void Dumper::dump(const char *dump_file)
 {
   bool done = false;
   Cond cond;
+  int r = 0;
   int rank = strtol(g_conf->name.get_id().c_str(), 0, 0);
   inodeno_t ino = MDS_INO_LOG_OFFSET + rank;
 
   lock.Lock();
-  journaler->recover(new C_SafeCond(&lock, &cond, &done));
+  journaler->recover(new C_SafeCond(&lock, &cond, &done, &r));
   while (!done)
     cond.Wait(lock);
   lock.Unlock();
 
+  if (r < 0) { // Error
+    derr << "error on recovery: " << cpp_strerror(r) << dendl;
+    messenger->shutdown();
+    // wait for messenger to finish
+    messenger->wait();
+    shutdown();
+  }
+
   uint64_t start = journaler->get_read_pos();
   uint64_t end = journaler->get_write_pos();
   uint64_t len = end-start;
@@ -136,6 +145,7 @@ void Dumper::dump(const char *dump_file)
     int err = errno;
     derr << "unable to open " << dump_file << ": " << cpp_strerror(err) << dendl;
   }
+
   messenger->shutdown();
 
   // wait for messenger to finish
index 43eca74aa0dde2082840be30e8ec707e42028428..ab19c50843554f5eae18ea1a9a9e13bf9a70d9eb 100644 (file)
@@ -255,7 +255,6 @@ void Journaler::reprobe(Context *finish)
 
 void Journaler::_finish_reprobe(int r, uint64_t new_end, Context *onfinish) {
   assert(new_end >= write_pos);
-  assert(r >= 0);
   ldout(cct, 1) << "_finish_reprobe new_end = " << new_end 
          << " (header had " << write_pos << ")."
          << dendl;
@@ -268,7 +267,9 @@ void Journaler::_finish_reprobe(int r, uint64_t new_end, Context *onfinish) {
 void Journaler::_finish_probe_end(int r, uint64_t end)
 {
   assert(state == STATE_PROBING);
-  
+  if (r < 0) { // error in probing
+    goto out;
+  }
   if (((int64_t)end) == -1) {
     end = write_pos;
     ldout(cct, 1) << "_finish_probe_end write_pos = " << end 
@@ -277,7 +278,6 @@ void Journaler::_finish_probe_end(int r, uint64_t end)
     assert(0); // hrm.
   } else {
     assert(end >= write_pos);
-    assert(r >= 0);
     ldout(cct, 1) << "_finish_probe_end write_pos = " << end 
            << " (header had " << write_pos << "). recovered."
            << dendl;
@@ -287,10 +287,11 @@ void Journaler::_finish_probe_end(int r, uint64_t end)
 
   prezeroing_pos = prezero_pos = write_pos = flush_pos = safe_pos = end;
   
+out:
   // done.
   list<Context*> ls;
   ls.swap(waitfor_recover);
-  finish_contexts(cct, ls, 0);
+  finish_contexts(cct, ls, r);
 }
 
 class Journaler::C_RereadHeadProbe : public Context