]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: lock NUDGE op that is tolerant of ambiguous/migrating auth
authorSage Weil <sage@newdream.net>
Tue, 3 Jun 2008 19:14:03 +0000 (12:14 -0700)
committerSage Weil <sage@newdream.net>
Tue, 3 Jun 2008 19:14:03 +0000 (12:14 -0700)
src/TODO
src/mds/Locker.cc
src/messages/MLock.h

index c5e59bca86c29423cc853824697519a3f6147ce0..a3557e03837cbc44e3956380848713af7cbb52cb 100644 (file)
--- a/src/TODO
+++ b/src/TODO
@@ -71,7 +71,7 @@ mds mustfix
 /- make sure predirty_nested stops if it can't wrlock versionlock (acquire_locks normally hides that detail for us)
 - make sure stray inode is always opened on startup
 /- make sure inode cache expire for frozen inode behaves
-- REQSCATTER/REQUNSCATTER ... can we avoid the auth pin requirement?
+/- REQUNSCATTER ... can we avoid the auth pin requirement?
 
 - look at the client_map session opening code.. versus rollback (of import, or slave request)
 
index 83c8a5393450955d18441184518df7645156afc6..de3c18e92c76384d988e2e52a43b5dfed1af3a65 100644 (file)
@@ -2431,16 +2431,15 @@ void Locker::scatter_nudge(ScatterLock *lock, Context *c)
             << *lock << " on " << *p << dendl;
     // request unscatter?
     int auth = lock->get_parent()->authority().first;
-    if (mds->mdsmap->get_state(auth) >= MDSMap::STATE_ACTIVE) {
-      if (lock->get_state() == LOCK_SCATTER)
-       mds->send_message_mds(new MLock(lock, LOCK_AC_REQUNSCATTER, mds->get_nodeid()), auth);
-      else
-       mds->send_message_mds(new MLock(lock, LOCK_AC_REQSCATTER, mds->get_nodeid()), auth);
-    }
+    if (mds->mdsmap->get_state(auth) >= MDSMap::STATE_ACTIVE)
+      mds->send_message_mds(new MLock(lock, LOCK_AC_NUDGE, mds->get_nodeid()), auth);
 
     // wait...
     if (c)
       lock->add_waiter(SimpleLock::WAIT_STABLE, c);
+
+    // also, requeue, in case we had wrong auth or something
+    updated_scatterlocks.push_back(&lock->xlistitem_updated);
   }
 }
 
@@ -2786,6 +2785,7 @@ void Locker::handle_scatter_lock(ScatterLock *lock, MLock *m)
     }
     break;
 
+    /*
   case LOCK_AC_REQUNSCATTER:
     if (!lock->is_stable()) {
       dout(7) << "handle_scatter_lock ignoring now-unnecessary unscatter request on " << *lock
@@ -2797,8 +2797,24 @@ void Locker::handle_scatter_lock(ScatterLock *lock, MLock *m)
     } else {
       dout(7) << "handle_scatter_lock DROPPING unscatter request on " << *lock
              << " on " << *lock->get_parent() << dendl;
-      /* FIXME: if we can't auth_pin here, this request is effectively lost... */
+      // FIXME: if we can't auth_pin here, this request is effectively lost... 
     }
+    break;
+    */
+
+  case LOCK_AC_NUDGE:
+    if (lock->get_parent()->is_auth()) {
+      dout(7) << "handle_scatter_lock trying nudge on " << *lock
+             << " on " << *lock->get_parent() << dendl;
+      scatter_nudge(lock, 0);
+    } else {
+      dout(7) << "handle_scatter_lock IGNORING nudge on non-auth " << *lock
+             << " on " << *lock->get_parent() << dendl;
+    }    
+    break;
+
+ default: 
+   assert(0);
   }
 
   delete m;
index 0ae5e6bfdafa34f5dcb1f699b0a4acf447f870e8..eb2004733f4276b57d36f6e6434e231dc0128a9e 100644 (file)
@@ -33,6 +33,7 @@
 
 #define LOCK_AC_REQSCATTER   7
 #define LOCK_AC_REQUNSCATTER 8
+#define LOCK_AC_NUDGE        9
 
 #define LOCK_AC_FOR_REPLICA(a)  ((a) < 0)
 #define LOCK_AC_FOR_AUTH(a)     ((a) > 0)
@@ -49,6 +50,7 @@ static const char *get_lock_action_name(int a) {
   case LOCK_AC_LOCKACK: return "lockack";
   case LOCK_AC_REQSCATTER: return "reqscatter";
   case LOCK_AC_REQUNSCATTER: return "requnscatter";
+  case LOCK_AC_NUDGE: return "nudge";
   default: assert(0); return 0;
   }
 }