]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: wait for journal safe when doing ino allocations
authorSage Weil <sage@newdream.net>
Fri, 9 Jan 2009 22:15:44 +0000 (14:15 -0800)
committerSage Weil <sage@newdream.net>
Fri, 9 Jan 2009 22:16:18 +0000 (14:16 -0800)
Stop-gap, I suppose.. we really want to wait for things to fully journal,
period.  Hmm.

src/mds/MDCache.h
src/mds/MDLog.cc
src/mds/MDLog.h
src/mds/Server.cc

index 3600a6a578064c4d49649ec73a9701f597a321f2..314b6430abc4bda771b444ff77a921ee317efc95 100644 (file)
@@ -345,7 +345,10 @@ struct MDRequest : public Mutation {
   }
 
   bool slave_did_prepare() { return more()->slave_commit; }
-  
+
+  bool did_ino_allocation() {
+    return alloc_ino || used_prealloc_ino || prealloc_inos.size();
+  }      
 
   void print(ostream &out) {
     out << "request(" << reqid;
index 7b919592caafaf38f5cbae7b5c37fc7aa30baef6..02078b6775603a270560c9b27dac24acaca0b1e4 100644 (file)
@@ -147,7 +147,7 @@ void MDLog::append()
 
 // -------------------------------------------------
 
-void MDLog::submit_entry( LogEvent *le, Context *c ) 
+void MDLog::submit_entry( LogEvent *le, Context *c, bool wait_safe ) 
 {
   if (!g_conf.mds_log) {
     // hack: log is disabled.
@@ -191,7 +191,9 @@ void MDLog::submit_entry( LogEvent *le, Context *c )
   
   if (c) {
     unflushed = 0;
-    journaler->flush(c);
+    journaler->flush(wait_safe ? 0:c);
+    if (wait_safe)
+      journaler->wait_for_flush(0, c);
   }
   else
     unflushed++;
index 6388219c890f378529abe1e79964bb974d3d94b3..83de89ed4dd783462d06acadbccd7ffff06afe59 100644 (file)
@@ -161,7 +161,7 @@ public:
   bool is_capped() { return capped; }
   void cap();
 
-  void submit_entry( LogEvent *e, Context *c = 0 );
+  void submit_entry( LogEvent *e, Context *c = 0, bool wait_for_safe=false );
   void wait_for_sync( Context *c );
   void wait_for_safe( Context *c );
   void flush();
index 50d62e4d6d5ec5f976baffbe3fb2940b991a6989..443eac8d2d14dcc0140b2eefa7df8ac9d31ef103 100644 (file)
@@ -2352,7 +2352,8 @@ void Server::handle_client_mknod(MDRequest *mdr)
 
   // log + wait
   mdr->committing = true;
-  mdlog->submit_entry(le, new C_MDS_mknod_finish(mds, mdr, dn, newi, follows));
+  mdlog->submit_entry(le, new C_MDS_mknod_finish(mds, mdr, dn, newi, follows),
+                     mdr->did_ino_allocation());
 }
 
 
@@ -2407,7 +2408,8 @@ void Server::handle_client_mkdir(MDRequest *mdr)
 
   // log + wait
   mdr->committing = true;
-  mdlog->submit_entry(le, new C_MDS_mknod_finish(mds, mdr, dn, newi, follows));
+  mdlog->submit_entry(le, new C_MDS_mknod_finish(mds, mdr, dn, newi, follows),
+                     mdr->did_ino_allocation());
 }
 
 
@@ -2454,7 +2456,8 @@ void Server::handle_client_symlink(MDRequest *mdr)
 
   // log + wait
   mdr->committing = true;
-  mdlog->submit_entry(le, new C_MDS_mknod_finish(mds, mdr, dn, newi, follows));
+  mdlog->submit_entry(le, new C_MDS_mknod_finish(mds, mdr, dn, newi, follows),
+                     mdr->did_ino_allocation());
 }
 
 
@@ -5109,7 +5112,7 @@ void Server::handle_client_openc(MDRequest *mdr)
 
   // log + wait
   C_MDS_openc_finish *fin = new C_MDS_openc_finish(mds, mdr, dn, in, follows);
-  mdlog->submit_entry(le, fin);
+  mdlog->submit_entry(le, fin, mdr->did_ino_allocation());
 }