]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: fix can_scatter_pin() to be only SYNC and MIX
authorSage Weil <sage@newdream.net>
Thu, 14 Oct 2010 22:07:16 +0000 (15:07 -0700)
committerSage Weil <sage@newdream.net>
Thu, 14 Oct 2010 22:07:16 +0000 (15:07 -0700)
Those are the only states where the replica can effectively prevent the
lock from cycling in a way that would force a frozen dirfrag beneath
the scatterpinned inode to update/journal something
(accounted_fragstat/rstat).

Signed-off-by: Sage Weil <sage@newdream.net>
src/mds/Migrator.cc
src/mds/ScatterLock.h

index c6e3e8907efab67e78416db47b4e4fbbafd0118b..3829679cd715bdc3871e52705779090abb96e006 100644 (file)
@@ -591,6 +591,9 @@ void Migrator::export_dir(CDir *dir, int dest)
   CInode *diri = dir->inode;
   if (!diri->can_scatter_pin()) {
     dout(7) << "export_dir couldn't pin parent inode scatterlocks, failing. " << *diri << dendl;
+
+    // XXX we should make some effort to move lock(s) to a state where we _can_ export!
+
     return;
   }
 
index ad1c0aa96b8a1c9aaca54f2873bea42eba2468b2..cf3751f72dc8f0282cc2045dce35184f3ccf1e13 100644 (file)
@@ -76,7 +76,17 @@ public:
   }
 
   bool can_scatter_pin(client_t loner) {
-    return can_rdlock(-1) || can_wrlock(loner);
+    /*
+      LOCK : NOT okay because it can MIX and force replicas to journal something
+      TSYN : also not okay for same reason
+      EXCL : also not okay
+
+      MIX  : okay, replica can stall before sending AC_SYNCACK
+      SYNC : okay, replica can stall before sending AC_MIXACK or AC_LOCKACK
+    */   
+    return
+      get_state() == LOCK_SYNC ||
+      get_state() == LOCK_MIX;
   }
 
   xlist<ScatterLock*>::item *get_updated_item() { return &more()->item_updated; }