]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
os/FileJournal: return errors on make_writeable() if reopen fails 1487/head
authorSage Weil <sage@inktank.com>
Mon, 17 Mar 2014 22:37:44 +0000 (15:37 -0700)
committerSage Weil <sage@inktank.com>
Mon, 17 Mar 2014 22:37:44 +0000 (15:37 -0700)
This is why #7738 is resulting in a crash instead of an error.

Signed-off-by: Sage Weil <sage@inktank.com>
src/os/FileJournal.cc
src/os/FileJournal.h
src/os/Journal.h
src/os/JournalingObjectStore.cc

index 3a344fa71015f3079e1aa22dc10b2d0f8eb9cb4a..54c03719e978a1c418a873edad2ce85dd485747b 100644 (file)
@@ -75,8 +75,8 @@ int FileJournal::_open(bool forwrite, bool create)
   fd = TEMP_FAILURE_RETRY(::open(fn.c_str(), flags, 0644));
   if (fd < 0) {
     int err = errno;
-    dout(2) << "FileJournal::_open: unable to open journal: open() failed: "
-           << cpp_strerror(err) << dendl;
+    dout(2) << "FileJournal::_open unable to open journal "
+           << fn << ": " << cpp_strerror(err) << dendl;
     return -err;
   }
 
@@ -1576,9 +1576,12 @@ void FileJournal::put_throttle(uint64_t ops, uint64_t bytes)
   }
 }
 
-void FileJournal::make_writeable()
+int FileJournal::make_writeable()
 {
-  _open(true);
+  dout(10) << __func__ << dendl;
+  int r = _open(true);
+  if (r < 0)
+    return r;
 
   if (read_pos > 0)
     write_pos = read_pos;
@@ -1588,6 +1591,7 @@ void FileJournal::make_writeable()
 
   must_write_header = true;
   start_writer();
+  return 0;
 }
 
 void FileJournal::wrap_read_bl(
index c69fc54c2820f6ac61eed2d9a98caf32db608037..dbb1181bc8ed678c37c44e1baf2bda7ee3ff24ce 100644 (file)
@@ -400,7 +400,7 @@ private:
   bool is_writeable() {
     return read_pos == 0;
   }
-  void make_writeable();
+  int make_writeable();
 
   // writes
   void commit_start(uint64_t seq);
index 1d413bb4c5311cd228a8b447f383f84990987462..4f8658fb418f279fa604e65b201aa456ca730c07 100644 (file)
@@ -56,7 +56,7 @@ public:
 
   // writes
   virtual bool is_writeable() = 0;
-  virtual void make_writeable() = 0;
+  virtual int make_writeable() = 0;
   virtual void submit_entry(uint64_t seq, bufferlist& e, int alignment,
                            Context *oncommit,
                            TrackedOpRef osd_op = TrackedOpRef()) = 0;
index e662580ac42bf3270a6c19d1cd50fab6bcbadade..402fa3cc9757a54d1152e61a8198819ea3280e88 100644 (file)
@@ -98,7 +98,9 @@ int JournalingObjectStore::journal_replay(uint64_t fs_op_seq)
   submit_manager.set_op_seq(op_seq);
 
   // done reading, make writeable.
-  journal->make_writeable();
+  err = journal->make_writeable();
+  if (err < 0)
+    return err;
 
   return count;
 }