]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: half-finished scatter timeouts
authorSage Weil <sage@newdream.net>
Tue, 3 Jun 2008 16:04:03 +0000 (09:04 -0700)
committerSage Weil <sage@newdream.net>
Tue, 3 Jun 2008 16:04:03 +0000 (09:04 -0700)
src/TODO
src/mds/Locker.cc
src/mds/Locker.h
src/mds/ScatterLock.h
src/mds/events/ECommitted.h [new file with mode: 0644]

index cda0fcbb0c2a6f517735badc08ee6793568b4d4e..b18cdabd05a2fc6e947e50e7821dc5a07e3c87d0 100644 (file)
--- a/src/TODO
+++ b/src/TODO
@@ -65,8 +65,6 @@ mon
 - osdmon needs to lower-bound old osdmap versions it keeps around?
 
 mds mustfix
-- fix rejoin vs updated dirfrag nested/dirlocks
-  - not inode_full, now.. send the fnode.  but for auth dirfrags, _to_ inode auth... which is sorta outside the subtree..?
 
 /- locks (esp scatter) vs rejoin, scatter_writebehind
 - make sure locker avoids frozen inodes
index 9913fecae0f290fec450f2e1ffebadd14db61364..5b9f626921658d1f153918913cd4dd54fee26afa 100644 (file)
@@ -1222,6 +1222,20 @@ void Locker::revoke_client_leases(SimpleLock *lock)
 // nested ---------------------------------------------------------------
 
 
+void Locker::mark_updated_scatterlock(ScatterLock *lock)
+{
+  lock->set_updated();
+  if (lock->xlistitem_updated.get_xlist()) {
+    dout(10) << "mark_updated_scatterlock " << *lock
+            << " -- already on list since " << lock->update_stamp << dendl;
+  } else {
+    updated_scatterlocks.push_back(&lock->xlistitem_updated);
+    lock->update_stamp = g_clock.now();
+    dout(10) << "mark_updated_scatterlock " << *lock
+            << " -- added at " << lock->update_stamp << dendl;
+  }
+}
+
 /*
  * NOTE: we _have_ to delay the scatter if we are called during a
  * rejoin, because we can't twiddle locks between when the
@@ -1357,7 +1371,7 @@ void Locker::predirty_nested(Mutation *mut, EMetaBlob *blob,
     }
     if (stop) {
       dout(10) << "predirty_nested stop.  marking dirlock on " << *pin << dendl;
-      pin->dirlock.set_updated();
+      mark_updated_scatterlock(&pin->dirlock);
       mut->add_updated_scatterlock(&pin->dirlock);
       mut->ls->dirty_dirfrag_dir.push_back(&pin->xlist_dirty_dirfrag_dir);
       break;
@@ -2766,6 +2780,28 @@ void Locker::scatter_unscatter_autoscattered()
     }
     if (--n == 0) break;
   }
+
+
+  // updated
+  while (!updated_scatterlocks.empty()) {
+    ScatterLock *lock = updated_scatterlocks.front();
+    
+    if (!lock->is_updated() ||
+       !lock->get_parent()->is_auth() ||
+       !lock->is_stable()) {
+      updated_scatterlocks.pop_front();
+      dout(10) << " removed from updated_scatterlocks " << *lock << " " << *lock->get_parent() << dendl;
+      continue;
+    }
+    
+    if (now - lock->update_stamp < 10.0)
+      break;
+
+    updated_scatterlocks.pop_front();
+
+    dout(10) << " scattering updated_scatterlocks item " << *lock << " " << *lock->get_parent() << dendl;
+    scatter_scatter(lock);
+  }
 }
 
 
index 48d46959530cbd3a0b9ede42f834a011c1a4c183..34266c87edf40961c9f4ce355440ca808c109a06 100644 (file)
@@ -164,7 +164,9 @@ protected:
   };
   void scatter_writebehind_finish(ScatterLock *lock, Mutation *mut);
 
+  xlist<ScatterLock*> updated_scatterlocks;
 public:
+  void mark_updated_scatterlock(ScatterLock *lock);
   void predirty_nested(Mutation *mut, EMetaBlob *blob, CInode *in, CDir *dir,
                       int flags, int linkunlink=0);
 
index 84416dcf2b387286239b85d9dc0b2504155d1a12..4c8ad48e7e1a5cab34238e9869e28fc35d0192ac 100644 (file)
@@ -69,12 +69,15 @@ class ScatterLock : public SimpleLock {
 
 public:
   xlist<ScatterLock*>::item xlistitem_autoscattered;
+  xlist<ScatterLock*>::item xlistitem_updated;
+  utime_t update_stamp;
 
   ScatterLock(MDSCacheObject *o, int t, int wo) : 
     SimpleLock(o, t, wo),
     num_wrlock(0),
     updated(false),
-    xlistitem_autoscattered(this) {}
+    xlistitem_autoscattered(this),
+    xlistitem_updated(this) {}
 
   int get_replica_state() {
     switch (state) {
diff --git a/src/mds/events/ECommitted.h b/src/mds/events/ECommitted.h
new file mode 100644 (file)
index 0000000..eb5a5ae
--- /dev/null
@@ -0,0 +1,44 @@
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
+/*
+ * Ceph - scalable distributed file system
+ *
+ * Copyright (C) 2004-2006 Sage Weil <sage@newdream.net>
+ *
+ * This is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software 
+ * Foundation.  See file COPYING.
+ * 
+ */
+
+#ifndef __MDS_ECOMMITTED_H
+#define __MDS_ECOMMITTED_H
+
+#include "../LogEvent.h"
+#include "EMetaBlob.h"
+
+class ECommitted : public LogEvent {
+public:
+  metareqid_t reqid;
+
+  ECommitted() : LogEvent(EVENT_COMMITTED) { }
+  ECommitted(metareqid_t r) : 
+    LogEvent(EVENT_COMMITTED), reqid(r) { }
+
+  void print(ostream& out) {
+    out << "ECommitted " << reqid;
+  }
+
+  void encode(bufferlist &bl) const {
+    ::encode(reqid, bl);
+  } 
+  void decode(bufferlist::iterator &bl) {
+    ::decode(reqid, bl);
+  }
+
+  void update_segment() {}
+  void replay(MDS *mds);
+};
+
+#endif